Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Push vs Map - add prop to object
(version: 1)
Comparing performance of:
Push vs Join
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
var objs = Array.from(new Array(10000)).map(() => ({ name: 'string' })) var result = []
Tests:
Push
for (let i = 0; i < objs.length; i++) { result.push({ ...objs[i], id: i }) }
Join
result = objs.map((a, i) => ({ ...a, id: i }))
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Push
Join
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
7 months ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:143.0) Gecko/20100101 Firefox/143.0
Browser/OS:
Firefox 143 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Push
927.9 Ops/sec
Join
3329.5 Ops/sec
Related benchmarks:
ForOf+Push vs Map
ForOf+Push vs Map 2
For + Push vs Map
Object spread vs New map
Object spread vs New map with string keys
Push vs Create Fill and Map vs Create with Array.From
test_spread_vs-map
Push vs Map mastermind
set prop on object vs array.push: no extra obj creation
Comments
Confirm delete:
Do you really want to delete benchmark?