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 isPP1(n) {
for (var m = 2; m * m <= n; ++ m)
for (var k = 2; Math.pow(m, k) <= n; ++ k)
if (Math.pow(m, k) == n) return [m, k];
return null;
}
function isPP2(n){
var maxB = Math.floor(Math.log2(n)+1);
var maxA = Math.floor(Math.sqrt(n));
for(var b = 2; b <= maxB; b++) {
for(var a = 1; a <= maxA; a++) {
if (Math.pow(a, b) === n) {
return [a, b];
}
}
}
return null;
}
var n = Math.floor(Math.random() * 1e8);
Ready to run.
Test | Ops/sec | |
---|---|---|
isPP1 |
| ready |
isPP2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.