Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash.mapKeys vs Native
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/133.0.0.0 Safari/537.36
Browser:
Chrome 133
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
lodash.mapKeys
4252677.0 Ops/sec
Object.keys with for loop
7559182.0 Ops/sec
Object.entries with for loop
7793279.0 Ops/sec
Object.keys with reduce
2913021.0 Ops/sec
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/lodash/4.16.0/lodash.min.js"></script>
Script Preparation code:
var value = {a: 30310, b: 100303, c: 3040494};
Tests:
lodash.mapKeys
const f = v => _.mapKeys(v, k => k + '-changed') f(value);
Object.keys with for loop
const f = v => { const m = {}; for (const k of Object.keys(v)) m[k + '-changed'] = v[k]; return m; } f(value)
Object.entries with for loop
const f = obj => { const m = {}; for (const [k, v] of Object.entries(obj)) m[k + '-changed'] = v; return m; } f(value)
Object.keys with reduce
const f = obj => Object.keys(obj).reduce( (acc, k) => ({ ...acc, [k + '-changed']: obj[k] }), {} ); f(value)