Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
hasOwnProperty vs NO-hasOwnProperty vs object.keys 2
(version: 1)
Comparing performance of:
hasOwnProperty vs NO-hasOwnProperty vs Object.keys
Created:
one year ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
let obj = { 'a': 1, 'b': 1, 'c': 1, 'd': 1, 'e': 1, 'f': 1, 'g': 1 };
Tests:
hasOwnProperty
let data = []; for (let key in obj) { if(obj.hasOwnProperty(key)) { data.push(key); } }
NO-hasOwnProperty
let data = []; for (let key in obj) { data.push(key); }
Object.keys
let data = Object.keys(obj);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
hasOwnProperty
NO-hasOwnProperty
Object.keys
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 18_2_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Mobile/15E148 Safari/604.1
Browser/OS:
Mobile Safari 18 on iOS 18.2.1
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
hasOwnProperty
35572076.0 Ops/sec
NO-hasOwnProperty
37762124.0 Ops/sec
Object.keys
441759424.0 Ops/sec
Related benchmarks:
hasOwnProperty speed
for-in vs object.keys vs object.keys 2
for-in with hasOwnProperty() vs object.keys
for-in vs for-of Object.keys 2
for-in-hasOwnProperty vs object.keys
for-in-hasOwnProperty vs object.keys-direct
for-in hasOwnProperty vs object.keys test vs for-in
Object.keys.length vs sum
hasOwnProperty vs NO-hasOwnProperty vs object.keys
Comments
Confirm delete:
Do you really want to delete benchmark?