Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.hasOwnProperty vs Object in vs Object[] vs Array.indexOf vs Array.includes times 10
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.5 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 17
Operating system:
iOS 17.5.1
Device Platform:
Mobile
Date tested:
one year ago
Test name
Executions per second
Object.hasOwnProperty
12656720.0 Ops/sec
Object in
11975800.0 Ops/sec
Array.indexOf
730114.2 Ops/sec
direct
11466132.0 Ops/sec
Array includes
269173.2 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)