Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object entry counting: Object.entries VS Object.keys VS Object.values
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:138.0) Gecko/20100101 Firefox/138.0
Browser:
Firefox 138
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.entries
566538.1 Ops/sec
Object.keys
4428614.0 Ops/sec
Object.values
1761631.4 Ops/sec
Script Preparation code:
function makeid() { var text = ""; var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; for (var i = 0; i < 5; i++) text += possible.charAt(Math.floor(Math.random() * possible.length)); return text; } window.parentObj = {}; for (let i = 0; i < 100; i++) { window.parentObj[makeid()] = { innerVal: makeid() }; }
Tests:
Object.entries
const newObj = {}; newObj.count = Object.entries(window.parentObj).length;
Object.keys
const newObj = {}; newObj.count = Object.keys(window.parentObj).length;
Object.values
const newObj = {}; newObj.count = Object.values(window.parentObj).length;