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 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Mobile Safari/537.36
Browser:
Chrome Mobile 129
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Object.hasOwnProperty
7.1M/s
Object in
5.6M/s
direct
5.2M/s
Array includes
337K/s
Array.indexOf
335K/s
View exact numbers
Test name
Executions per second
✓
Object.hasOwnProperty
7,148,720 Ops/sec
Object in
5,607,710 Ops/sec
direct
5,227,122 Ops/sec
Array includes
337,329 Ops/sec
Array.indexOf
335,306 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)