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){
for(var i = 2 ; i <= Math.sqrt(n) | 0 ; ++i)
{
if( n % i == 0)
{
var k = Math.round( Math.log(n) / Math.log(i) );
if( Math.pow(i,k) == n) return [i,k];
}
}
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.