Object.hasOwnProperty vs Object in vs Array.indexOf vs direct vs Array includes vs Object.prototype.hasOwnProperty.call(this.storeIndex, index) vs Reflect.has()Fastest: Object.hasOwnProperty (18.6x faster)
22,937,006 ops/sec
20,496,688 ops/sec
20,037,964 ops/sec
9,005,722 ops/sec
8,766,198 ops/sec
1,295,460 ops/sec
1,230,290 ops/sec
Results show median performance across all community submissions. Run this benchmark yourself to verify on your device.
| Test case name | Result |
|---|---|
| Object.hasOwnProperty | |
| Object in | |
| Array.indexOf | |
| direct | |
| Array includes | |
| Object.prototype.hasOwnProperty.call(this.storeIndex, index) | |
| Reflect.has() |
| Test name | Executions per second |
|---|---|
| ✓ Object.prototype.hasOwnProperty.call(this.storeIndex, index) | 50,132,140 Ops/sec |
| Object in | 44,411,640 Ops/sec |
| Reflect.has() | 33,991,588 Ops/sec |
| Object.hasOwnProperty | 22,937,006 Ops/sec |
| direct | 20,037,964 Ops/sec |
| Array.indexOf | 773,872 Ops/sec |
| Array includes | 611,551 Ops/sec |