New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dramatically improve LocalCollection sorting performance. #969

Closed
wants to merge 1 commit into
base: devel
from

Conversation

Projects
None yet
2 participants
@jagill
Contributor

jagill commented Apr 20, 2013

Currently, LocalCollection._insertInSortedList uses an insertion-sort type of insertion (which goes like O(n^2)). This PR replaces it with a binary search type insertion (which goes like O(n lg n)).

The current method is very non-performant for large collections. An {{#each}} block for a collection of 5000 elements dies incomplete after 15 seconds with the current method (and sometimes crashes Firefox). With the binary search change, it renders in 5 seconds.

Replacing the insert method in sorting.
It has been replaced with a binary search, instead of
an insertion-sort O(n^2) search.
@jagill

This comment has been minimized.

Contributor

jagill commented Apr 30, 2013

Any thoughts on this PR? Without it, MadEye crashes on sufficiently large projects. With it, it's fine.

@jagill

This comment has been minimized.

Contributor

jagill commented May 7, 2013

@glasser Thought you merged this?

Also, i notice coffeescript has corrupted me, and I declared some global variables. Sorry about that. I'm guessing that's in what you fixed.

@glasser

This comment has been minimized.

Member

glasser commented May 7, 2013

Yup, I merged it.

@glasser glasser closed this May 7, 2013

@jagill jagill referenced this pull request May 29, 2013

Closed

Firefox memory leak #1111

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment