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
This page tests speed of two different methods for array concatenation. Array method concat() has no side effects (it creates a new array to store its result in), while Array.prototype.push.apply(A, [1, 2, ...]) extends the array A.
<script>
var len = 20150;
var x = new Array(len),
y = new Array(150),
z = new Array(len*2);
for (var i = 0; i < len; i++) {
x[i] = i;
}
for (var i = 0; i < 2*len; i++) {
z[i] = i;
}
for (var i = 0; i < 150; i++) {
x[i] = i;
}
</script>
Ready to run.
Test | Ops/sec | |
---|---|---|
concat |
| ready |
Array.prototype.push.apply |
| ready |
concat 2 |
| ready |
Array.prototype.push.apply 2 |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.