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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2.1 Safari/605.1.15
Browser:
Safari 17
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
in
21.8M/s
hasOwnProperty
21.7M/s
direct access (bool)
21.5M/s
object
9.3M/s
View exact numbers
Test name
Executions per second
✓
in
21,842,560 Ops/sec
hasOwnProperty
21,722,368 Ops/sec
direct access (bool)
21,524,704 Ops/sec
object
9,271,661 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')