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 arrayCopy( arr ) {
var ret = new Array(arr.length);
for( var i = 0, len = arr.length; i < len; ++i ) {
ret[i] = arr[i];
}
return ret;
}
function arrayCopy2( arr ) {
var ret = [];
for( var i = 0, len = arr.length; i < len; ++i ) {
ret[i] = arr[i];
}
return ret;
}
function arrayCopyForloop(arr) {
var ret = new Array(arr.length);
for (var i = 0, len = arr.length; i < len; ret[i] = arr[i++]);
return ret;
}
</script>
var arr = [1, 2, 3, 4, 5, 6],
res = [];
var res = [];
Ready to run.
Test | Ops/sec | |
---|---|---|
Concat (individual) |
| ready |
Slice |
| ready |
while [ ] |
| ready |
while push |
| ready |
arrayCopy |
| ready |
for |
| ready |
concat |
| ready |
arrayCopy2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.