Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
my testtestets
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36
Browser:
Chrome 129
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
find
173.9 Ops/sec
map
3045.7 Ops/sec
Script Preparation code:
function getRandomElement(id) { return { id, a: Math.random(), b: Math.random(), c: Math.random(), } } function getArray(length) { const result = []; for (let i = 0; i < length; i++) { result.push(getRandomElement(i)) } return result; } function arrayToMap(array) { return new Map(array.map(el => [el.id, el])); } function getRandomInt(max) { return Math.floor(Math.random() * max); } array_small = getArray(10000); map_small = arrayToMap(array_small);
Tests:
find
for (let i = 0; i < 1000; i++) { const target = getRandomInt(9999); array_small.find(el => el.id === target); }
map
for (let i = 0; i < 1000; i++) { const target = getRandomInt(9999); map_small.get(target); }