Skip to content
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

wants to merge 1 commit into from


Copy link

@jagill 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.

It has been replaced with a binary search, instead of
an insertion-sort O(n^2) search.
Copy link
Contributor Author

@jagill jagill commented Apr 30, 2013

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

Copy link
Contributor Author

@jagill 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.

Copy link

@glasser glasser commented May 7, 2013

Yup, I merged it.

@glasser glasser closed this May 7, 2013
@jagill jagill mentioned this pull request May 29, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants