Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Usporedba Optimised 100
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/121.0.0.0 Safari/537.36
Browser:
Chrome 121
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
Find person in map
3174938.2 Ops/sec
Find person in array
2057381.8 Ops/sec
Script Preparation code:
window.bigMap = {}; window.bigArray = Array.from({length: 100}).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 }) window.generateId = function generateId() { return "person-id-" + Math.floor(Math.random() * 100); } window.getPersonFromMap = function getPersonFromMap() { const id = generateId(); return window.bigMap[id]; } window.getPersonFromArray = function getPersonFromArray() { const id = generateId(); return window.bigArray.find(function findById(p){ return p.id === id; }); } for (let i = 0; i < 10000; i++) { getPersonFromMap() } for (let i = 0; i < 10000; i++) { getPersonFromArray() }
Tests:
Find person in map
getPersonFromMap()
Find person in array
getPersonFromArray()