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
/*
int
for_loop(double c, int n) {
double z = 0;
for (int k = 0; k < n; k++) {
if (z*z > 4)
return 0;
z = z*z + c;
}
return 1;
}
*/
const wasm_bin = Uint8Array.from(
[0,97,115,109,1,0,0,0,1,7,1,96,2,124,127,
1,127,3,2,1,0,5,3,1,0,2,6,8,1,127,1,65,
128,136,4,11,7,21,2,6,109,101,109,111,114,
121,2,0,8,102,111,114,95,108,111,111,112,
0,0,10,86,1,84,3,1,127,1,124,1,127,65,1,
33,2,2,64,32,1,65,1,72,13,0,68,0,0,0,0,0,
0,0,0,33,3,65,1,33,4,3,64,32,4,32,1,78,34,
2,13,1,32,4,65,1,106,33,4,32,3,32,3,162,
32,0,160,34,3,32,3,162,68,0,0,0,0,0,0,16,
64,100,69,13,0,11,11,32,2,11,0,38,4,110,
97,109,101,1,11,1,0,8,102,111,114,95,108,
111,111,112,7,18,1,0,15,95,95,115,116,97,
99,107,95,112,111,105,110,116,101,114,0,
45,9,112,114,111,100,117,99,101,114,115,1,
12,112,114,111,99,101,115,115,101,100,45,
98,121,1,12,85,98,117,110,116,117,32,99,
108,97,110,103,6,49,52,46,48,46,54]
);
const wasm_module = new WebAssembly.Module(wasm_bin);
const wasm_instance = new WebAssembly.Instance(wasm_module);
const for_loop_wasm = wasm_instance.exports.for_loop;
function for_loop(c, n) {
let z = 0;
for (let k = 0; k < n; k++) {
if (z*z > 4)
return 0;
z = z*z + c;
}
return 1;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
wasm |
| ready |
js |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.