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 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
let result = '';
for (let i = 0; i < length; i++) {
result += characters.charAt(Math.floor(Math.random() * characters.length));
}
return result;
}
const arrayData = Array.from({ length: 120 }, () => ({
id: generateRandomString(Math.floor(Math.random() * (30 - 15 + 1)) + 15),
["name-de"]: generateRandomString(Math.floor(Math.random() * (30 - 15 + 1)) + 15)
}));
function getLocalizedValue(resultObject, key, locale){
const constructedKey = buildKey(key, locale);
const value = resultObject[constructedKey];
return value;
}
const buildKey = (key, locale) => {
const languageCode = locale.split('-')[0];
return `${key}-${languageCode}`;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
foreach |
| ready |
map |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.