Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
for(const item of array) vs. for(const [k, v] of Object.entries(object))
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
for(const item of array)
15308425.0 Ops/sec
for(const [k, v] of Object.entries(object))
3188438.0 Ops/sec
Script Preparation code:
const ARRAY = [{ key: 'a', foo: 'bar' }, { key: 'b', foo: 'bar' }, { key: 'c', foo: 'bar' }, { key: 'd', foo: 'bar' }]; const OBJECT = {'a': { foo: 'bar' }, 'b': { foo: 'bar' }, 'c': { foo: 'bar' }, 'd': { foo: 'bar' }};
Tests:
for(const item of array)
for(const item of ARRAY) { const test = true; }
for(const [k, v] of Object.entries(object))
for(const [k, v] of Object.entries(OBJECT)) { const test = true; }