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
Compares calculation of byte size from a string
function randomString(minLen = 1, maxLen = 5000, chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789') {
const len = Math.floor(Math.random() * (maxLen - minLen + 1)) + minLen; // length in [1,5000]
const out = new Array(len);
const n = chars.length;
for (let i = 0; i < len; i++) out[i] = chars[Math.floor(Math.random() * n)];
return out.join('');
}
const body = randomString();Ready to run.
| Test | Ops/sec | |
|---|---|---|
| new TextEncoder().encode().length | | ready |
| new Blob().size | | ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.