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
not only is most code out there unoptimized, but i've also seen syntactically horrible and even wrong code, so i'm searching for the best solution in this perf (dont expect readable code, i'm aiming more for performance here)
let arr1 = [];
let arr2 = [];
// adds random 100 numbers to the end of arr1 and to the start of arr2
for(let i = 0;i < 100;i++) {
let number = Math.floor(Math.random() * 100);
arr1.push(number);
arr2.unshift(number);
}
Ready to run.
Test | Ops/sec | |
---|---|---|
naive imperative solution |
| ready |
solution using Map (1) |
| ready |
solution using Map (2) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.