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 = ["foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat", "foo", "bar", "baz", "lorem", "ipsum", "lol", "cat"];
var func = function(arg) {
return arg + "X";
};
Array.prototype.forEach2 = function(a) {
var l = this.length;
for (var i = 0; i < l; i++) {
this[i] = a(this[i], i);
}
};
Array.prototype.forEach3 = function(fun /*, thisArg */ ) {
"use strict";
if (this === void 0 || this === null)
throw new TypeError();
var t = Object(this);
var len = t.length >>> 0;
if (typeof fun !== "function")
throw new TypeError();
var thisArg = arguments.length >= 2 ? arguments[1] : void 0;
for (var i = 0; i < len; i++) {
if (i in t)
fun.call(thisArg, t[i], i, t);
}
};
Ready to run.
Test | Ops/sec | |
---|---|---|
for, reversed |
| ready |
for |
| ready |
foreach |
| ready |
custom foreach |
| ready |
Custom foreach #2 |
| ready |
normal for |
| ready |
for, cached length |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.