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
Check if it's more useful to clone an ArrayBuffer and transfer it or just let the StructuredClone do its magic.
// create a worker with inline script blob
let script = "onmessage = e => postMessage({ id: e.data.id })";
let blob = URL.createObjectURL(new Blob([script]));
let worker = new Worker(blob);
// setup handler to resolve promises
let resolve;
worker.onmessage = e => { if (resolve) { r = resolve; resolve = null; r(); } };
// buffers: zeroes and filled random
let plain = new ArrayBuffer(1024*1024);
let buf = new ArrayBuffer(1024*1024);
for (let i = 0; i < 16; i++) {
crypto.getRandomValues(new Uint8Array(buf, i*65536, 65536));
}
worker.terminate()
Ready to run.
Test | Ops/sec | |
---|---|---|
{ buf } |
| ready |
{ buf.slice } |
| ready |
{ buf.slice } + transfer |
| ready |
{ buf.slice } + transfer (zeroes) |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.