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
<script>
var toInteger1 = function (n) {
n = +n;
if (n !== n) // isNaN
n = -1;
else if (n !== 0 && n !== (1/0) && n !== -(1/0))
n = (n > 0 || -1) * Math.floor(Math.abs(n));
return n;
};
function toInteger2(value) {
value = +value;
return value === 0 || !isFinite(value) ? value || 0 : value - (value % 1);
}
function test(f) {
f(1); f(2); f(3); f(4); f(5);
f(-1); f(-2);
f(10.0);
f("10");
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
2 |
| ready |
1 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.