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 minMath = (x, y) => Math.min(x, y);
const minTernary = (x, y) => x < y ? x : y;
const minInt32BitOps = (x, y) => x & ((x - y) >> 31) | y & (~(x - y) >> 31);
function getRandomInt32() {
const min = -2147483648; // minimum value of a 32-bit signed integer
const max = 2147483647; // maximum value of a 32-bit signed integer
return Math.floor(Math.random() * (max - min + 1)) + min;
}
let bh = 0;
if (Math.random() > 1) console.log(bh);
Ready to run.
Test | Ops/sec | |
---|---|---|
Math.min |
| ready |
Math.min+fn |
| ready |
Ternary |
| ready |
Bit ops |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.