Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Usporedba
(version: 0)
Comparing performance of:
Find person in map vs Find person in array
Created:
2 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
window.bigMap = {}; window.bigArray = Array.from({length: 100000}).map((_, index) => { const id = "person-id-" + index; const person = { id: id, name: `John Doe ${id}`, age: 18 + Math.floor(Math.random() * 70) }; bigMap[id] = person; return person })
Tests:
Find person in map
const id = "person-id-" + Math.floor(Math.random() * 100000); const person = window.bigMap[id];
Find person in array
const id = "person-id-" + Math.floor(Math.random() * 100000); const person = window.bigArray.find(p => p.id === id);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Find person in map
Find person in array
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
2 years ago
)
User agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36
Browser/OS:
Chrome 121 on Mac OS X 10.15.7
View result in a separate tab
Embed
Embed Benchmark Result
Test name
Executions per second
Find person in map
3856267.5 Ops/sec
Find person in array
3667.1 Ops/sec
Related benchmarks:
Search: Array to Map and find vs Array.find
test map lodash vs array
Map.get versus Array.find for 10000 elements
Map.get versus Array.find for 1000 elements
Search: Array to Map and find vs Array.find685000
Comments
Confirm delete:
Do you really want to delete benchmark?