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
Fastest method of convert array-like to actual arrays
var nativeSlice = Array.prototype.slice,
nativeConcat = Array.prototype.concat,
nativePush = Array.prototype.push;
function pushtest() {
var args = [];
args.push.apply(args, arguments);
}
function nativePushTest() {
nativePush.apply([], arguments);
}
function concattest() {
var args = [].concat(arguments);
}
function slicetest() {
var args = nativeSlice.call(arguments);
}
function iteratetest() {
var args = [], i, l;
for (i = 0, l = arguments.length; i < l; i++) {
args[i] = arguments[i];
}
}
function iterate2test() {
var args = [];
for (var i = 0, l = arguments.length; i < l; i++) {
args.push(arguments[i]);
}
}
function iterate3test() {
var i =0, l = arguments.length, args = new Array(l);
for (; i < l; i++) {
args[i] = arguments[i];
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
push |
| ready |
concat |
| ready |
slice |
| ready |
iterate |
| ready |
Native Push Test |
| ready |
iterate2 |
| ready |
iterate3 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.