Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
KeyBy vs Map 2
KeyBy vs Map 2
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/148.0.0.0 Safari/537.36
Browser:
Chrome 148
Operating system:
Windows
Device Platform:
Desktop
Date tested:
25 days ago
Test name
Executions per second
Lodash
26951.8 Ops/sec
Native
13674.0 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
const count = 1000; const users = Array.from({ length: count }, (_, i) => ({ id: i + 1, value: Math.random().toString(36).substring(2, 9) // 7 random chars }));
Tests:
Lodash
_.keyBy(users, u => u.id);
Native
new Map(users.map(u => [u.id, u]));