Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
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 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36 Edg/147.0.0.0
Browser:
Chrome 147
Operating system:
Windows
Device Platform:
Desktop
Date tested:
16 days ago
Test name
Executions per second
object with keys
271236.2 Ops/sec
object with values
1250003.4 Ops/sec
object with entries 1
69164.0 Ops/sec
object with entries 2
67354.0 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], );