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 generateRandomString(length) {
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
let result = '';
for (let i = 0; i < length; i++) {
const randomIndex = Math.floor(Math.random() * characters.length);
result += characters.charAt(randomIndex);
}
return result;
}
function generateRandomEntry() {
const entry = {};
if (Math.random() < 0.95) {
entry.node = {
system: { uid: generateRandomString(Math.floor(Math.random() * 26) + 5) },
title: generateRandomString(Math.floor(Math.random() * 26) + 5),
url: generateRandomString(Math.floor(Math.random() * 26) + 5)
};
} else {
entry.node = {};
}
return entry;
}
function generateRandomArray(length) {
const array = [];
for (let i = 0; i < length; i++) {
array.push(generateRandomEntry());
}
return array;
}
const input = generateRandomArray(1000);
Ready to run.
Test | Ops/sec | |
---|---|---|
reduce |
| ready |
filtermap |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.