Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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
Benchmark engine:
Benchmark.js
Spread operator
40.0M/s
Push with spread operator
30.9M/s
Push with simple for
18.4M/s
View exact numbers
Test name
Executions per second
✓
Spread operator
40,034,928 Ops/sec
Push with spread operator
30,932,658 Ops/sec
Push with simple for
18,357,972 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]); }