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
"use strict";
class Test {
constructor(N) {
const array = this.array = Array(N);
for (let i = 0; i < N; ++i) {
array[i] = ~~(Math.random() * 100);
}
}
doubleMethod(x) {
return x * 2;
}
useCallback(callback) {
const array = this.array;
const len = array.length;
let y;
for (let i = 0; i < len; ++i)
y = callback(array[i]);
}
noop() {
const array = this.array;
const len = array.length;
let y;
for (let i = 0; i < len; ++i)
y = array[i];
}
inlined() {
const array = this.array;
const len = array.length;
let y;
for (let i = 0; i < len; ++i)
y = array[i] * 2;
}
}
function doubleFunction(x) {
return x * 2;
}
const tester = new Test(10000);
Ready to run.
Test | Ops/sec | |
---|---|---|
Arrow function |
| ready |
Standalone function |
| ready |
Method |
| ready |
Noop |
| ready |
Inlined |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.