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
const repeat = (arr, n) => Array(n).fill(arr).flat();
const list = [1,2,3,4,5,6,7,9,10, ...repeat(11, 500)];
const identityFunction = (item) => item;
function uniqBy(
array,
keyOrFunc = identityFunction
) {
let ret = [];
let seen = new Set();
let getter = typeof keyOrFunc === 'function' ? keyOrFunc : (item) => item[keyOrFunc];
array.forEach((item) => {
let val = getter(item);
if (!seen.has(val)) {
seen.add(val);
ret.push(item);
}
});
return ret;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Set |
| ready |
ember |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.