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
Check tests: http://jsperf.com/mootools-array-uniq-vs-vanilla
Faster(1.5 - 34 times) Array.unique speed.
You're storing the values in an object, with the values as keys. Doing that will call valueOf() of each value. When the values are strings or numbers it's ok, however with other objects this probably won't work.
Also could you provide some http://jsperf.com
unique fn fix, support objects and functions.
Much faster than original http://jsperf.com/mootools-array-uniq-vs-vanilla/2
new unique support null
Updated. Tests: http://jsperf.com/mootools-array-uniq-vs-vanilla/2
Please check it. Do we need sugar or speed in core code? Need a framework for micro optimizations?
Very nice, however the cases I tried to explain, still don't work, see http://jsfiddle.net/EJX8n/ with your code and http://jsfiddle.net/EJX8n/1/ with the current code.
Faster is better, but what's more important is readability and API. Especially with these JS functions, which are usually not the bottleneck in your application (compared to DOM stuff).
Thanks for your effort though, much appreciated! If you see other possible improvements, please let us know :D