Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
forinvsobjectkeys2
(version: 0)
Comparing performance of:
forin vs objectkeys
Created:
one year ago
by:
Guest
Jump to the latest result
Script Preparation code:
const fakeData = { item1: { isTexture: true }, item2: { isTexture: false }, item3: { isTexture: true }, item4: { isTexture: false }, item5: { isTexture: true }, item6: { isTexture: false }, item7: { isTexture: true } };
Tests:
forin
for(i=0; i<10000; i++){ let texturesForIn = []; for (const key in fakeData) { const value = fakeData[key]; if (value && value.isTexture) { texturesForIn.push(value); } } }
objectkeys
for(i=0; i<10000; i++){ let texturesObjectKeys = []; const keys = Object.keys(fakeData); for (let i = 0; i < keys.length; i++) { const key = keys[i]; const value = fakeData[key]; if (value && value.isTexture) { texturesObjectKeys.push(value); } } }
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
forin
objectkeys
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Comments
Confirm delete:
Do you really want to delete benchmark?