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 str2ab(str) {
var buf = new ArrayBuffer(str.length * 2); // 2 bytes for each char
var bufView = new Uint16Array(buf);
for (var i = 0, strLen = str.length; i < strLen; i++) {
bufView[i] = str.charCodeAt(i);
}
return buf;
}
var hexEncodeArray = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F',
];
var hexEncodeArray256 = [];
hexEncodeArray256.length = 256;
for (var i = 0; i < 256; i++) {
hexEncodeArray256[i] = i.toString(16);
}
var buf = str2ab("the quick red fox jumped over the lazy brown dog");
var arr = new Uint8Array(buf);
Ready to run.
Test | Ops/sec | |
---|---|---|
hex by array lookup 16 |
| ready |
hex by toString(16) |
| ready |
hex by array lookup 256 |
| ready |
hex by ASMCrypto |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.