Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Object.hasOwnProperty vs Object in vs Object[] vs Array.indexOf vs Array.includes
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/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Linux
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
Object.hasOwnProperty
4.6M/s
direct
4.5M/s
Object in
4.5M/s
Array includes
810K/s
Array.indexOf
801K/s
View exact numbers
Test name
Executions per second
✓
Object.hasOwnProperty
4,581,330 Ops/sec
direct
4,539,056 Ops/sec
Object in
4,482,722 Ops/sec
Array includes
810,281 Ops/sec
Array.indexOf
800,754 Ops/sec
Script Preparation code:
var object = {}, array = [], i, test = 1000; for (i = 0; i < 1000; i++) { object['something' + i] = true; array.push('something' + i); }
Tests:
Object.hasOwnProperty
object.hasOwnProperty('something' + test)
Object in
('something' + test) in object
Array.indexOf
array.indexOf('something' + test) !== -1
direct
object['something' + test] === true
Array includes
array.includes('something' + test)