Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
foreach: object keys vs object values vs object entries
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/139.0.0.0 Safari/537.36
Browser:
Chrome 139
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
object with values
348K/s
object with keys
100K/s
object with entries 1
20K/s
object with entries 2
20K/s
View exact numbers
Test name
Executions per second
✓
object with values
348,231 Ops/sec
object with keys
99,700 Ops/sec
object with entries 1
20,309 Ops/sec
object with entries 2
19,754 Ops/sec
Script Preparation code:
var obj = {}; for (i = 0; i < 1000; ++i) { obj[i] = i; }
Tests:
object with keys
Object.keys(obj).forEach( (key) => key, );
object with values
Object.values(obj).forEach( (value) => value, );
object with entries 1
Object.entries(obj).forEach( (entry) => entry, );
object with entries 2
Object.entries(obj).forEach( ([key, value]) => [key, value], );