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 (Macintosh; Intel Mac OS X 10.15; rv:144.0) Gecko/20100101 Firefox/144.0
Browser:
Firefox 144
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
object with values
311K/s
object with keys
162K/s
object with entries 1
77K/s
object with entries 2
63K/s
View exact numbers
Test name
Executions per second
✓
object with values
310,653 Ops/sec
object with keys
162,373 Ops/sec
object with entries 1
77,245 Ops/sec
object with entries 2
62,562 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], );