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 array = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
Array.prototype.Aggregate = function(fn) {
var current, length = this.length;
if (length == 0) throw "Reduce of empty array with no initial value";
current = this[0];
for (var i = 1; i < length; ++i) {
current = fn(current, this[i]);
}
return current;
};
console.log(total);
Ready to run.
Test | Ops/sec | |
---|---|---|
forEach |
| ready |
reduce |
| ready |
for |
| ready |
aggregate |
| ready |
while |
| ready |
son of while |
| ready |
evil eval |
| ready |
for 2 |
| ready |
for 3 |
| ready |
for 4 |
| ready |
for 5 |
| ready |
for 6 |
| ready |
for 7 |
| ready |
For(get) it and use tail recursion... |
| ready |
Tail Recursion - no slice |
| ready |
Tail recursion with global reference |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.