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
async function digest(size) {
const msg = crypto.getRandomValues(new Uint8Array(size));
const len = msg.length;
const arr = new Uint8Array(len + 6);
arr.set(msg, 0);
let i = 0;
while (i++ < 2e14) {
for (let j = 5, bits = i; j >= 0; --j) {
arr[len + j] = bits & 0xff;
bits >>= 8;
}
const hash = await window.crypto.subtle.digest("SHA-256", arr);
const res = new Uint8Array(hash);
if (res[0] === 0 && res[1] === 0 && res[2] !== 0) {
return i;
}
}
return -1;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
16 |
| ready |
20 |
| ready |
24 |
| ready |
30 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.