Skip to content

Add optional dependency for SortedContainers library #29

@ajcr

Description

@ajcr

Rolling median uses a basic SortedList implementation (binary search/insert on a Python list).

The SortedList implementation in sortedcontainers is more advanced and will scale better for larger window sizes.

This should be an added as an optional dependency (e.g. pip install rollling[extras]) and rolling median should use the third party sortedcontainers implementation if it's available:

try:
    from sortedcontainers import SortedList
except Import Error:
    from rolling.structures.sorted_list import SortedList

Some minor work is needed to make the SortedList method names compatible with the calls in the rolling median implementation (or vice versa).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions