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
const rand = crypto.getRandomValues(new Uint8Array(65536))
const blob = Promise.resolve(new Blob(new Array(16).fill(rand)))
const toBase64 = (bytes) => {
let binary = '';
// Convert the bytes into a binary string, which we then call btoa on to base64-encode it.
// Doing it 8 bytes at a time seems fastest, from experimentation.
let i = 0;
for (; i + 7 < bytes.byteLength; i += 8) {
binary += String.fromCharCode(bytes[i], bytes[i + 1], bytes[i + 2], bytes[i + 3], bytes[i + 4], bytes[i + 5], bytes[i + 6], bytes[i + 7]);
}
for (; i < bytes.byteLength; i++) {
binary += String.fromCharCode(bytes[i]);
}
return btoa(binary);
};
Ready to run.
Test | Ops/sec | |
---|---|---|
FileReader |
| ready |
toBase64 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.