Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Lodash.set vs direct access
(version: 0)
Comparing performance of:
lodash.set vs direct access
Created:
3 years ago
by:
Guest
Jump to the latest result
HTML Preparation code:
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
Script Preparation code:
var foo = { bar: { baz: '$ReplaceMe' } };
Tests:
lodash.set
_.set(foo, 'bar.baz', 'FooBarBaz');
direct access
function replace(obj) { Object.fromEntries(Object.entries(foo).map((entry) => { if(entry.value === '$ReplaceMe') { return [entry.key, 'FooBarBaz']; } else if (typeof entry.value === 'object') { return [entry.key, replace(entry.value)]; } return entry; })) } replace(foo);
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
lodash.set
direct access
Fastest:
N/A
Slowest:
N/A
Latest run results:
No previous run results
This benchmark does not have any results yet. Be the first one
to run it!
Related benchmarks:
Spread Operator vs Lodash Small Array
lodash trim vs replace
lodash vs native replace
lodash _.indexOf vs native indexOf with strings
Comments
Confirm delete:
Do you really want to delete benchmark?