Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
set.has vs. array.includes large 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/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
lookup
2.2M/s
includes
1K/s
View exact numbers
Test name
Executions per second
✓
lookup
2,238,842 Ops/sec
includes
1,089 Ops/sec
Script Preparation code:
const NUM_ITEMS = 1000000; var a = []; for(let i = 1; i < NUM_ITEMS; i++) { a.push(i); } var b = new Set(a)
Tests:
includes
const NUM_ITEMS = 1000000; return a.includes(Math.random() * NUM_ITEMS)
lookup
const NUM_ITEMS = 1000000; return b.has(Math.random() * NUM_ITEMS)