Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object.Values + Map vs for-in push
(version: 1)
Comparing performance of:
for-in push vs Object.Values map
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const record = { jhon: {name: "jhon", lastname: "smith"}, doe: {name: "jhon", lastname: "doe"}, maria: {name: "maria", lastname: "lagg"}, }
Tests:
for-in push
const array = []; for(const key in record){ const item = record[key]; array.push({firstName: item.name,lastName: item.lastname}); }
Object.Values map
const array = Object.values(record).map(item => ({firstName: item.name,lastName: item.lastname}));
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
for-in push
Object.Values map
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36
Browser/OS:
Chrome 134 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
for-in push
20865522.0 Ops/sec
Object.Values map
20350020.0 Ops/sec
Related benchmarks:
prepend
Object in vs Object[]
for vs map to fill array
For i / For of / ForEach
Array keys spread vs for
Test of 2
Test of 2.1
map.set vs array.push
[] + push vs new Array() + index insertion
Comments
Confirm delete:
Do you really want to delete benchmark?