Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Search: Array to Map and find vs Array.find
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:123.0) Gecko/20100101 Firefox/123.0
Browser:
Firefox 123
Operating system:
Mac OS X 10.15
Device Platform:
Desktop
Date tested:
2 years ago
Array.find
13.0M/s
Array to Map and find
352K/s
View exact numbers
Test name
Executions per second
✓
Array.find
13,006,212 Ops/sec
Array to Map and find
352,413 Ops/sec
Script Preparation code:
data = [...Array(100)].map((_, id) => ({ id, data: Math.random() }))
Tests:
Array to Map and find
const res = new Map(data.map(v => [v.id, v])).get(50)
Array.find
const res = data.find(({ id }) => id === 50)