jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
var array = [1,3,6,73,4,6,6,4,34,2,56,79,5,786,55143,4253,76,878,76354,54,4,543564,56473,456,34,3,2,3,4,67,7,4,4,2,5,7,9,0,8,7,5,43,32,3,5,56,6,9];
var uniqueByReduce = function(a) {
return a.reduce(function(p, c) {
if (p.indexOf(c) < 0) p.push(c);
return p;
}, []);
};
var uniqueByIndexOf = function(a) {
var unique = [];
for (var i = 0; i < a.length; i++) {
if (unique.indexOf(a[i]) == -1) {
unique.push(a[i]);
}
}
return unique;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Reduce |
| ready |
IndexOf |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.