Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Push vs Concat
Has Array.prototype.push more perf than Array.prototype.concat?
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.0.0 Safari/537.36
Browser:
Chrome 117
Operating system:
Android
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Push
204.7 Ops/sec
Concat
14.0 Ops/sec
Script Preparation code:
var ar = []; var ar2 = []; for (var i = 0; i < 10 * 1000; i++) { ar[i] = i; ar2[i] = i; }
Tests:
Push
for (var i = 0, len = ar2.length; i < len; i++) { ar.push(ar2[i]); }
Concat
ar = ar.concat(ar2);