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 generateContacts(size) {
return [...Array(size)].map((_, i) => ({id: Math.floor(Math.random() * size * 100), name: `jane doe #${i}`}));
}
function sample(arr) {
const sampledElements = [];
const totalElements = arr.length;
for (let i = 0; i < 100; i++) {
const randomIndex = Math.floor(Math.random() * totalElements);
sampledElements.push(arr[randomIndex].id);
}
return sampledElements;
}
const allContacts = generateContacts(10000);
const selectedContactIds = sample(allContacts);
Ready to run.
Test | Ops/sec | |
---|---|---|
array |
| ready |
set |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.