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 fib1(n) {
if (n < 2)
return 1;
return fib1(n - 1) + fib1(n - 2);
}
function *fib2(n) {
if (n < 2) return 1;
return (yield fib2(n - 1)) + (yield fib2(n - 2));
}
function trampoline(it) {
let stack = [];
let val;
while (true) {
let {done, value} = it.next(val);
if (done) {
if (stack.length === 0)
return value;
it = stack.pop();
val = value;
continue;
}
stack.push(it);
it = value;
val = undefined;
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
Recursive function |
| ready |
Generator |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.