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 count = 1e6;
const data = Array.from({length: count}).map(() => Math.random());
const simpleSum = (data) => {
let sum = 0;
for(let i=0; i < data.length; i += 1) {
sum += data[i];
}
return sum;
}
const parallelSum = (data) => {
let sum1 = 0;
let sum2 = 0;
for(let i=0; i < data.length; i += 2) {
sum1 += data[i];
sum2 += data[i + 1] ?? 0;
}
return sum1 + sum2;
};
const lightlyParallelSum = (data) => {
let sum = 0
for(let i=0; i < data.length; i += 2) {
sum += data[i] + (data[i + 1] ?? 0);
}
return sum;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Unrolled - Two Variable |
| ready |
Regular |
| ready |
Unrolled - One Variable |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.