GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
Some testing by @mauritslamers indicates that this optimized code delivers a human-noticeable speedup to Array#filter when run on ridiculously large arrays.
Minor optimizations to Array#filterProperty.
After reading this, and comparing with my test data, it turns out my test data turns out not to have any undefined items, so I don't expect much difference.
As you write: the more tests we do outside the loop the better. Therefore every test that is done inside the loop needs to be reviewed. For example: how often does it occur that we have arrays with mixed standard objects and SC objects? A test is done against .get for every iteration of the loop, while I think it is unlikely that an array will have a mix of SC objects and hashes.
The same goes for SC.isEqual, which perhaps should only be called on SC objects, not on hashes.
this should probably be idx, not index :)
Indeed. Fixed in latest. Like I said, I had to run to work and didn't have time to run it properly, or even unit test, and jslint has so many problems with that file that it was no help at all... =)
Boneheaded typo fix.
Rebased onto master. Thanks!