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 = [];
for(var i = 0; i < 1000; i++)array[i] = Math.floor(Math.random() * 1000000);
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;
};
Array.prototype.AggregateCacheRef = function(fn) {
var current
, a = this
, length = a.length;
if (length == 0) throw "Reduce of empty array with no initial value";
current = a[0];
for (var i = 1; i < length; ++i)
{
current = fn(current, a[i]);
}
return current;
};
console.log(total);
Ready to run.
Test | Ops/sec | |
---|---|---|
forEach |
| ready |
reduce |
| ready |
for |
| ready |
aggregate |
| ready |
AggregateCacheRef |
| ready |
reduce max |
| ready |
for max |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.