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
<script>
function arrayProtoSlice() {
return Array.prototype.slice.apply(arguments);
}
function arrayLiteralSlice() {
return [].slice.apply(arguments);
}
var slice = [].slice;
function closure() {
return slice.call(arguments);
}
function splice() {
return [].splice.call(arguments, 0);
}
function push() {
var x = [];
x.push.apply(x, arguments);
return x;
}
function unshift() {
var x = [];
x.unshift.apply(x, arguments);
return x;
}
function whileDec() {
var arr = [],
i = arguments.length;
while(i--) {
arr[i] = arguments[i];
}
return arr;
}
function arrayApply() {
return Array.apply(null, arguments);
}
var bigArray = new Array(1001).join("a").split("");
var smallArray = new Array(6).join("a").split("");
unshift.apply(null, bigArray).length === bigArray.length || alert('unshift broken');
push.apply(null, bigArray).length === bigArray.length || alert('push broken');
splice.apply(null, bigArray).length === bigArray.length || alert('splice broken');
arrayProtoSlice.apply(null, bigArray).length === bigArray.length || alert('arrayProtoSlice broken');
arrayLiteralSlice.apply(null, bigArray).length === bigArray.length || alert('arrayLiteralSlice broken');
whileDec.apply(null, bigArray).length === bigArray.length || alert('arrayLiteralSlice broken');
arrayApply.apply(null, bigArray).length === bigArray.length || alert('arrayAppy broken');
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
Array prototype slice |
| ready |
Array literal slice |
| ready |
Array push |
| ready |
Array splice |
| ready |
Unshift |
| ready |
Closure |
| ready |
While loop |
| ready |
Array Apply |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.