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
Turning an array of objects into a pointer driven list could -- and should -- make loops faster.
let itemArray = [
{ a : 1 },
{ a : 2 },
{ a : 4 },
{ a: 8 },
{ a : 16 },
{ a : 32 },
{ a : 64 },
{ a : 128 }
];
// 0x08 shl 0x0D == 0x00010000 entries
for (let i = 0; i < 0x0D; i++) itemArray = itemArray.concat(itemArray);
// create Index
for (let i = 0; i < itemArray.length; i++) {
itemArray[i].nextItem = itemArray[i + 1];
}
document.body.textContent = '';
Ready to run.
Test | Ops/sec | |
---|---|---|
Normal for loop |
| ready |
Sibling walking |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.