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 100000
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/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.hasOwnProperty
11170897.0 Ops/sec
Object in
10310120.0 Ops/sec
Array.indexOf
168909.5 Ops/sec
direct
10335731.0 Ops/sec
Array includes
173754.6 Ops/sec
Script Preparation code:
var object = {}, array = [], i, test = 10000 for (i = 0; i < 10000; 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)