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
/** @type {(l: number) => string} */
function createRandomString (l) {
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_!&$=/#'
const res = []
for (let i = 0; i < l; i += 1) {
res.push(chars.charAt(Math.floor(Math.random() * chars.length)))
}
return res.join('')
}
/** @type {(_: { min: number, max: number }) => number} */
function getRandomNumber (_) {
return (Math.random() * (_.max - _.min)) + _.min
}
const a = []
const b = []
for (let i = 0; i < 1e6; i += 1) {
const o = { csn: createRandomString(16), dateMs: getRandomNumber({ min: 1e13, max: 2e13 }) }
b.push(o)
a.push([o.csn, o.dateMs].join('§'))
}
Ready to run.
Test | Ops/sec | |
---|---|---|
sort string[] ASC |
| ready |
sort attr1 string then attr2 number ASC |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.