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
Object.keys
4.4M/s
Object.values
1.8M/s
Object.entries
567K/s
View exact numbers
Test name
Executions per second
✓
Object.keys
4,428,614 Ops/sec
Object.values
1,761,631 Ops/sec
Object.entries
566,538 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;