Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
hasOwnProperty vs Object.keys
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/132.0.0.0 Safari/537.36 Edg/132.0.0.0
Browser:
Chrome 132
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
hasOwnProperty
712656.4 Ops/sec
Object.keys
1416973.4 Ops/sec
Script Preparation code:
var props = {a:1,b:1,c:1,d:1,e:1,f:1,g:1,h:1,i:1,j:1,k:1,l:1,m:1,n:1,o:1,p:1,q:1,r:1,s:1,t:1,u:1,v:1,w:1,x:1,y:1,z:1};
Tests:
hasOwnProperty
for (var p in props) { if (Object.prototype.hasOwnProperty.call(props, p)) { props[p] = 2; } }
Object.keys
for (var k=Object.keys(props), l=k.length, i=0; i<l; i++) { props[k[i]] = 2; }