Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
map and find may vs array find may
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0
Browser:
Firefox 148
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one month ago
Test name
Executions per second
create map and find may
3.3 Ops/sec
array find may
0.3 Ops/sec
Script Preparation code:
var arr = Array.from({length: 1000000}).map((_,i) => ({id: i})); var findTargets = Array.from({length: 1000}).map((_,i) => idGen()); function idGen() { return Math.floor(Math.random() * 1000000) % 1000000 }
Tests:
create map and find may
const arrMap = new Map(arr.entries()); findTargets.forEach(target => arrMap.get(target));
array find may
findTargets.forEach(target => arr.find((i) => i.id === target));