Skip to content

Poor "add" performance on sorted collections #3242

@dts

Description

@dts

I am having significant performance problems when adding items separately to a sorted collection. This appears to be because a whole-list sort happens every time an item is added. In my case, I cannot roll all of the additions into a single addition operation (which would trigger only one sort).

Performance could be improved by using binary search to find the insertion point (unfortunately not with underscore's sortedIndex, as this does not take a comparator), and inserting the record at the appropriate location instantly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions