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
Various popular methods to cast Float to Int. Added context code that observes and acts upon test calculations. This is to prevent "dead code elimination" and encourage realistic optimization from the JavaScript VM.
<p id="acc"></p>
function update(a, b) {
return (b - a) / 2.0;
}
function finish(acc) {
let elem = document.getElementById("acc");
elem.innerText = acc;
}
function numbers() {
const size = 16384;
const array = new Int32Array(size);
crypto.getRandomValues(array);
const floats = new Float32Array(size);
for(let x = 0; x < size; x++)
floats[x] = array[x] / size;
return floats;
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Math.floor |
| ready |
Math.trunc |
| ready |
Bitwise OR |
| ready |
Bitwise RIGHT |
| ready |
Bitwise LEFT |
| ready |
Bitwise NOT |
| ready |
parseInt |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.