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
// Setup
const SIZE = 10000; // Size of the array and object
let testArray = [];
let testObject = {};
let testMap = new Map();
// Array buffer
const buffer = new ArrayBuffer(SIZE * Int32Array.BYTES_PER_ELEMENT);
const intArray = new Int32Array(buffer);
// Initialize the array and object with the same data
for (let i = 0; i < SIZE; i++) {
testArray.push(i);
testObject[i] = i;
testMap.set(i, i);
intArray[i] = i;
}
// Generate a random index for lookup
const randomIndex = Math.floor(Math.random() * SIZE);
Ready to run.
Test | Ops/sec | |
---|---|---|
Array Index Lookup |
| ready |
Object Key Lookup |
| ready |
Array Buffer Lookup |
| ready |
Map Lookup |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.