Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
hasOwnProperty vs direct access (bool) vs in 2
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/135.0.0.0 Safari/537.36
Browser:
Chrome 135
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Benchmark engine:
Benchmark.js
direct access (bool)
204.1M/s
in
201.4M/s
hasOwnProperty
97.5M/s
object
83.0M/s
View exact numbers
Test name
Executions per second
✓
direct access (bool)
204,143,856 Ops/sec
in
201,358,592 Ops/sec
hasOwnProperty
97,512,392 Ops/sec
object
82,969,592 Ops/sec
Script Preparation code:
var x = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8, i: 9}
Tests:
hasOwnProperty
x.hasOwnProperty("a")
direct access (bool)
x["a"]
in
"a" in x
object
Object.prototype.hasOwnProperty.call(x, 'a')