Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
js spread vs push on new array
(version: 1)
Comparing performance of:
spread vs push
Created:
3 months ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var arr1 = [ {"test1":"value1", "test2": "value2"} ] var arr2 = [ {"test3":"value3", "test3": "value3"} ]
Tests:
spread
var result = [...arr1, ...arr2]
push
var result = [] arr1.forEach(t => result.push(t)) arr2.forEach(t => result.push(t))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
spread
push
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
3 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0
Browser/OS:
Firefox 147 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
spread
15512582.0 Ops/sec
push
20472158.0 Ops/sec
Related benchmarks:
In place array concatenation benchmark.
Spread vs push testq
Add multiple elements to array: push vs destructuring
spread vs push - simple3
Add new element to array: push vs destructuring multiple entries
spread vs forEach push
spread vs forEach push v3
Add new array to array: push vs destructuring
spread vs forEach push v4
Comments
Confirm delete:
Do you really want to delete benchmark?