Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
array includes vs object key (small)
Performance comparison of ways to find if an array contains a value
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/147.0.0.0 Safari/537.36
Browser:
Chrome 147
Operating system:
Linux
Device Platform:
Desktop
Date tested:
22 days ago
Test name
Executions per second
Includes
132031288.0 Ops/sec
Object[key]
190685904.0 Ops/sec
HTML Preparation code:
Object[key]
Script Preparation code:
var obj = (new Array(10)).fill(null).reduce((prev, newVal) => {prev[Math.random() + ''] = Math.random() + ''; return prev; }, { sausage: 'tst' }); var array = Object.keys(obj);
Tests:
Includes
array.includes('sausage')
Object[key]
obj['sausage']