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
// Generates random strings
const rnd = (() => {
const gen = (min, max) => max++ && [...Array(max-min)].map((s, i) => String.fromCharCode(min+i));
const sets = {
num: gen(48,57),
alphaLower: gen(97,122),
alphaUpper: gen(65,90),
special: [...`~!@#$%^&*()_+-=[]\{}|;:'",./<>?`]
};
function* iter(len, set) {
if (set.length < 1) set = Object.values(sets).flat();
for (let i = 0; i < len; i++) yield set[Math.random() * set.length|0]
}
return Object.assign(((len, ...set) => [...iter(len, set.flat())].join('')), sets);
})();
const generateOrgLikeObj = () => {
const result = {}
for (let i = 0; i < 40; i++) {
result[i] = rnd(1000)
}
return result
}
// Create two org-like objects (flat, 40 keys, 1000 bytes per key)
const oldObj = generateOrgLikeObj()
const newObj = generateOrgLikeObj()
Ready to run.
Test | Ops/sec | |
---|---|---|
Assign |
| ready |
Spread |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.