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
fac1 = function(n) {
var r = 1;
for (var i = 2; i <= n; i++) {
r *= i;
}
return r;
}
fac2 = function(n) {
var r = 1;
while (n > 1) {
r = r * n--;
}
return r;
}
// This function was compiled from:
// fac3 = (n) -> product [1 to n]
var fac3;
fac3 = function(n) {
return product((function() {
var i$, to$, results$ = [];
for (i$ = 1, to$ = n; i$ <= to$; ++i$) {
results$.push(i$);
}
return results$;
}()));
};
product = function(xs) {
var result, i$, len$, x;
result = 1;
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
x = xs[i$];
result *= x;
}
return result;
};
Ready to run.
Test | Ops/sec | |
---|---|---|
For-Factorial |
| ready |
While-Factorial |
| ready |
LiveScript-Factorial |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.