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 _map = (arr, fn) => {
const r = new Array(arr.length)
for (let i = 0; i < arr.length; i++) r[i]=fn(arr[i]);
return r
}
const stringClone = (fn, key) => {
let _fn = stringClone.dict.get(key);
if (_fn === undefined) {
_fn = new Function(`return (${fn.toString()})`)()
stringClone.dict.set(key, _fn)
}
return _fn
};
stringClone.dict = new WeakMap()
const mapH = (arr, fn) => stringClone(_map, fn)(arr, fn)
const each1 = (i) => i + 1
const each2 = (i) => i + 2
const arr = new Array(1000).fill(true)
Ready to run.
Test | Ops/sec | |
---|---|---|
_map |
| ready |
mapH |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.