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
Tis
const strings = [];
const numbers = [];
const shortStrings = [];
const stringMap = {};
const sparseArray = [];
const numberMap = {};
const stringNumberMap = {};
for (let i = 0; i < 1000; i += 1) {
let n = i * 65;
strings.push(n + (' string nu').repeat(1))
numbers.push(n);
shortStrings.push(n + '');
stringMap[strings[n]] = n;
sparseArray[n] = n;
numberMap[n] = n;
stringNumberMap[n] = n;
stringNumberMap[strings[n]] = n;
}
const notUsedEver = {};
for (let i = 0; i < 105000; i++) {
let a = i + 5;
notUsedEver[a] = i;
notUsedEver[a + a] = i;
notUsedEver[a + '' + a] = i;
}Ready to run.
| Test | Ops/sec | |
|---|---|---|
| lookup string | | ready |
| lookup arr | | ready |
| lookup number map | | ready |
| string in String number map | | ready |
| number in String number map | | ready |
| double | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.