Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Set (Lodash vs Lodash/fp vs Immutable) comp. test
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/120.0.0.0 Safari/537.36
Browser:
Chrome 120
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Test name
Executions per second
native (mutations)
5994754.5 Ops/sec
lodash (mutations)
6403374.0 Ops/sec
lodash/fp
1229610.1 Ops/sec
immutable
3142573.8 Ops/sec
HTML Preparation code:
<script src='https://cdn.jsdelivr.net/g/lodash@4(lodash.min.js+lodash.fp.min.js)'></script> <script type='text/javascript' src='https://cdnjs.cloudflare.com/ajax/libs/immutable/5.0.0-beta.4/immutable.min.js'></script>
Script Preparation code:
var fp = _.noConflict(); var im = Immutable; var original = { x: { y: { z: 123 }}}; function pureJs(obj, path, value) { const keys = Object.keys(path); let current = obj; for (let i = 0; i < keys.length - 1; i++) { const key = keys[i]; if (!current[key]) { current[key] = {}; } current = current[key]; } current[keys[keys.length - 1]] = value; }
Tests:
native (mutations)
pureJs(original, ['x', 'y', 'z'], 456)
lodash (mutations)
_.set(original, ['x', 'y', 'z'], 456)
lodash/fp
fp.set(original, ['x', 'y', 'z'], 456)
immutable
im.setIn(original, ['x', 'y', 'z'], 456)