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 colSize = 20_000;
const colCount = 5_000;
const toFind = `${Math.floor(Math.random() * (colCount/4))+ Math.floor(colCount*0.75)}-${Math.floor(Math.random() * (colSize/4)) + Math.floor(colSize*0.75)}`;
console.log(toFind)
function build() {
return Array.from({length:colCount}).reduce((agg, _, idx) => {
agg.push({items:
Array.from({length:colSize}).reduce((iagg, _, iidx) => {
iagg.push(`${idx}-${iidx}`);
return iagg;
},[])}
);
return agg;
}, []);
}
const builtCollections = build();
function findCollectibleInCollections(
collections,
id,
) {
for (const collection of collections ?? []) {
for (const item of collection.items) {
if (item === id) {
return item;
}
}
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
function |
| ready |
straight loop |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.