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 arrayProtoSliceCall(args, skip) {
return Array.prototype.slice.call(args, skip)
}
function whileLoopCall(args, skip) {
var arr = [],
i = args.length;
while (i-- > skip) {
arr[i] = args[i];
}
return arr.slice(skip);
}
function whileLoopCall2(args, skip) {
var arr = [],
i = args.length;
while (i-- > skip) {
arr[i - skip] = args[i];
}
return arr;
}
var f = {
arrayProtoSliceCall: function() {
return arrayProtoSliceCall(arguments, 1)
},
whileLoopCall: function() {
return whileLoopCall(arguments, 1)
},
whileLoopCall2: function() {
return whileLoopCall2(arguments, 1)
},
directCall: function() {
var skip = 1;
var arr = [],
i = arguments.length;
while (i-- > skip) {
arr[i - skip] = arguments[i];
}
return arr;
},
directCallFor: function() {
skip = 1;
var i = arguments.length,
result = new Array(i - skip);
i--;
for (; i >= skip; i--) result[i - skip] = arguments[i];
return result;
}
}
Ready to run.
Test | Ops/sec | |
---|---|---|
arrayProtoSliceCall |
| ready |
whileLoopCall |
| ready |
whileLoopCall2 |
| ready |
directCallWhile |
| ready |
directCallFor |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.