Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
test forin vs keys+foreach+for
(version: 1)
Comparing performance of:
for in test vs keys+foreach vs test for
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let temp = { "surname": "Verdi", "name": "Giovanni", "cfPiva": "VRDGVN90C12E567Z", "plate": "IJ789KL", "birthDate": "1990-10-20", "proviceBirth": "Torino", "cityBirth": "Torino", "proviceResidence": "Torino", "cityResidence": "Torino", "company": "LMN Srl", "mainRole": "Ingegnere", "roles": "Sviluppatore, Progettista", "injuries": "Nessuno" };let imports={};
Tests:
for in test
for (const key in temp) { imports[key] = "true"; }
keys+foreach
Object.keys(temp).forEach(key => { imports[key] = "true"; });
test for
let array = Object.keys(temp); for (let index = 0; index < array.length; index++) { imports[array[i]] = "true"; }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
for in test
keys+foreach
test for
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/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Windows
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
for in test
3546726.8 Ops/sec
keys+foreach
3250035.8 Ops/sec
test for
10595269.0 Ops/sec
Related benchmarks:
find vs getBYkey
Lodash vs JSON vs Ramda vs old school
Lodash vs JSON vs Ramda vs the dirty
TR for of VS foreach a
Underscore vs native flat
spread vs obj
Lodash cloneDeep VS spread operator - 2
test forin vs keys+foreach
Deep copies
Comments
Confirm delete:
Do you really want to delete benchmark?