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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
for(const item of array)
107861376.0 Ops/sec
for(const [k, v] of Object.entries(object))
7931163.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; }