Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
hasOwnProperty vs Object.entries
Testing performance of a loop with hasOwnProperty vs a loop with 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/122.0.0.0 Safari/537.36
Browser:
Chrome 122
Operating system:
Windows
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
for in with hasOwnProperty
10871671.0 Ops/sec
for of with Object.entries
4500234.0 Ops/sec
Tests:
for in with hasOwnProperty
const props = { color: 'red', value: 'abc', fill: 'outline', button: true, redirect: 10, other: 'hello', object: { test: true }}; let result = {}; for (const prop in props) { if (props.hasOwnProperty(prop)) { result[prop] = props[prop]; } }
for of with Object.entries
const props = { color: 'red', value: 'abc', fill: 'outline', button: true, redirect: 10, other: 'hello', object: { test: true }}; let result = {}; for (const [prop, value] of Object.entries(props)) { result[prop] = value; }