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 100000000
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36 Edg/128.0.0.0
Browser:
Chrome 128
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.hasOwnProperty
10385175.0 Ops/sec
Object in
9634507.0 Ops/sec
Array.indexOf
970.8 Ops/sec
direct
9462828.0 Ops/sec
Array includes
958.4 Ops/sec
Script Preparation code:
var object = {}, array = [], i, test = 1000000 for (i = 0; i < 1000000; 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)