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
Comparison of Array.at vs length - 1.
// We cannot use floating point numbers, since their operations are not actually associative, so we make them all integers
let array = new Array(100000).fill(0).map(() => ~~(Math.random() * 100));
let sum = array.reduce((lhs, rhs) => lhs + rhs);
array.length = 0;
Ready to run.
Test | Ops/sec | |
---|---|---|
Backwards sum with .length |
| ready |
Backwards sum with .at |
| ready |
Forwards with .length |
| ready |
Forwards with cached .length |
| ready |
Forwards with let of |
| ready |
Forwards with var of |
| ready |
Forwards with const of |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.