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
count = 0;
function branchy(x) {
if (x == 1) {
count |= 2;
} else if (x == 2) {
count |= 3;
} else if (x == 3) {
count |= 15;
} else if (x == 4) {
count |= 18;
} else if (x == 5) {
count |= 21;
}
}
arr = new Int32Array(1);
arr[0] = 5;
closure = function(val) {
return function() { branchy (val); }
}(arr[0]);
closureWithConst = function(val) {
const v = val;
return function() { branchy (v); }
}(arr[0]);
Ready to run.
Test | Ops/sec | |
---|---|---|
Direct Call |
| ready |
Simple Closure |
| ready |
Closure with Const |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.