Finding with Set compared to loop

Benchmark created on


Setup

const bigArray = Array.from(Array(10000).keys())

const set = new Set(bigArray)
const map = new Map(bigArray.map(i => [i,i]))

Test runner

Ready to run.

Testing in
TestOps/sec
Finding with set
set.has(5000)
ready
Finding with includes
bigArray.includes(5000)
ready
Finding in a map
map.get(5000)
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.