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
var approx_const_32, approx_const_64, approx_const_quake_32, fastInvSqrt_typed;
approx_const_quake_32 = 0x5f3759df;
approx_const_32 = 0x5f375a86;
approx_const_64 = 0x5fe6eb50c7aa19f9;
fastInvSqrt_typed = function(n, precision) {
var i, iter, y;
if (precision == null) {
precision = 1;
}
y = new Float32Array(1);
i = new Int32Array(y.buffer);
y[0] = n;
i[0] = 0x5f375a86 - (i[0] >> 1);
for (iter = 1; 1 <= precision ? iter < precision : iter > precision; 1 <= precision ? iter++ : iter--) {
y[0] = y[0] * (1.5 - ((n * 0.5) * y[0] * y[0]));
}
return y[0];
};
rsqrtFloat = new Float32Array(1);
rsqrtInt = new Int32Array(rsqrtFloat.buffer);
rsqrtIntConst32 = 0x5f375a86;
Math.rsqrt = function(num) {
rsqrtFloat[0] = num;
rsqrtInt[0] = rsqrtIntConst32 - (rsqrtInt[0] >> 1);
rsqrtFloat[0] = rsqrtFloat[0] * (1.5 - ((num * 0.5) * rsqrtFloat[0] * rsqrtFloat[0]));
return rsqrtFloat[0];
};
Ready to run.
Test | Ops/sec | |
---|---|---|
Math.sqrt |
| ready |
fast inverse sqrt |
| ready |
Math.rsqrt |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.