Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
set.has vs. array.includes vs object lookup (larger array)
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
includes
3715081.8 Ops/sec
lookup
180131648.0 Ops/sec
object key
176005232.0 Ops/sec
array find
217228.8 Ops/sec
Script Preparation code:
var a = new Array(10000).fill(null).map((_, i) => i).sort(() => Math.random() - 0.5) var b = new Set(a) var c = a.reduce((a, b) => ({ ...a, b: true }), {})
Tests:
includes
return a.includes(1)
lookup
return b.has(1)
object key
return c[1]
array find
return a.find(n => n === 100)