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
function makePoint() {
return { x: Math.random(), y: Math.random() };
}
function makeBounds() {
return { start: makePoint(), end: makePoint() };
}
function makeMetadata() {
return { color: `${Math.random()}` };
}
function makeId() { return (Math.random() * (2**30)) | 0; }
function makeShape() {
return {
id: makeId(),
typeId: makeId(),
bounds: makeBounds(),
metadata: makeMetadata(),
}
}
const len = 30_000;
const aos = Array();
for (let i = 0; i < len; i++) {
aos.push(makeShape());
}
const soa = {
ids: new Int32Array(len),
typeIds: new Int32Array(len),
startX: new Float64Array(len),
endX: new Float64Array(len),
startY: new Float64Array(len),
endY: new Float64Array(len),
}
for (let i = 0; i < len; i++) {
soa.ids[i] = aos[i].id;
soa.typeIds[i] = aos[i].typeId;
soa.startX[i] = aos[i].bounds.start.x;
soa.endX[i] = aos[i].bounds.end.x;
soa.startY[i] = aos[i].bounds.start.y;
soa.endY[i] = aos[i].bounds.start.y;
}Ready to run.
| Test | Ops/sec | |
|---|---|---|
| AOS max Y | | ready |
| SOA max Y | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.