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 a = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
var [w,x,y,z] = [[],[],[],[]];
var cFilter = (fn, arr) => arr.reduce((newArr, item) => {
return fn(item) ? newArr.concat([item]) : newArr;
}, []);
var sFilter = (fn, arr) => arr.reduce((newArr, item) => {
return fn(item) ? [...newArr, item] : newArr;
}, []);
var pFilter = (fn, arr) => arr.reduce((newArr, item) => {
if (fn(item)) {
newArr.push(item);
return newArr;
}
return newArr;
}, []);
var aFilter = (fn, arr) => arr.reduce((newArr, item) => {
if (fn(item)) {
newArr[newArr.length] = item;
return newArr;
}
return newArr;
}, []);
[w,x,y,z] = [[],[],[],[]];
Ready to run.
Test | Ops/sec | |
---|---|---|
concat |
| ready |
spread |
| ready |
push |
| ready |
assign |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.