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);
}
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;
}
var bigArray = ((new Array(1000)).join("a,") + "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');
</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 |
You can edit these tests or add more tests to this page by appending /edit to the URL.