p3drosola/Backbone.VirtualCollection — pull request #43 by disruptek (2014-05-12 23:33:20+00:00)
Title: when comparator is absent, match parent collection sort order (rebased)

I had to add a bit of boilerplate to make v0.5 serve as a drop-in replacement for v0.4. This will need some testing by others; I think it should cover all the bases but I'm not certain.

It seemed like a good idea to actually test this stuff in my application before submitting this PR. This code doesn't just add default collection ordering where none existed before; it also replaces the O(N*log(N)) invocation of (potentially expensive) comparators with O(N) hash membership tests. For me, this has resulted in a performance improvement of something like 10,000x for a typical stack of Virtual Collections.

Now Backbone.Collection is the weak link. :-)