Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
JS Spread operator vs push
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Spread operator
40034928.0 Ops/sec
Push with spread operator
30932658.0 Ops/sec
Push with simple for
18357972.0 Ops/sec
Script Preparation code:
var foo = [ 2, 5, 7 ]; var bar = [ 3, 4, 6 ];
Tests:
Spread operator
var result = [ ...foo, ...bar ];
Push with spread operator
var result = []; result.push(...foo); result.push(...bar);
Push with simple for
var result = []; for (var i = 0; i < foo.length; i++){ result.push(foo[i]); } for (var j = 0; j < foo.length; j++){ result.push(bar[j]); }