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 sumByTwo = (data) => {
let sum = 0
for(let i=0; i < data.length; i += 2) {
sum += data[i] + data[i + 1];
}
return sum;
}
const sumByFour = (data) => {
let sum = 0
for(let i=0; i < data.length; i += 4) {
sum += data[i]
+ data[i + 1]
+ data[i + 2]
+ data[i + 3];
}
return sum;
}
const sumByTen = (data) => {
let sum = 0;
for(let i=0; i < data.length; i += 10) {
sum += data[i] + data[i + 1]
+ data[i + 2] + data[i + 3]
+ data[i + 4] + data[i + 5]
+ data[i + 5] + data[i + 7]
+ data[i + 8] + data[i + 9];
}
return sum;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Regular |
| ready |
By Two |
| ready |
By Four |
| ready |
By Ten |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.