Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Array.some() vs Array.map().includes()
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64; rv:145.0) Gecko/20100101 Firefox/145.0
Browser:
Firefox 145
Operating system:
Linux
Device Platform:
Desktop
Date tested:
8 months ago
Array.some()
1828.2M/s
Array.map().includes()
122.4M/s
View exact numbers
Test name
Executions per second
✓
Array.some()
1,828,167,296 Ops/sec
Array.map().includes()
122,370,088 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
const arrayLength = 50; const randomIndexForIdToFind = Math.random() * (arrayLength - 1) + 1; const idToFind = 'foo'; const arr = []; for (let i = 0; i < arrLength ; i++) { if (i === randomIndexForIdToFind) { arr.push({ foo: { id: idToFind }}); } else { arr.push({ foo: { id: 'bar' }}); } }
Tests:
Array.map().includes()
arr.map(e => e.foo.id).includes(idToFind);
Array.some()
arr.some(e => e.foo.id === idToFind);