Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.fromEntries vs lodash fromPairs vs Object.assign vs Object spread with custom func
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/131.0.0.0 Safari/537.36
Browser:
Chrome 131
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.fromEntries
9002239.0 Ops/sec
_.fromPairs
6755774.5 Ops/sec
Object.assign
19589822.0 Ops/sec
Object spread
14817065.0 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
Object.fromEntries
var a = [['a', 1], ['b', 2], ['c', 3]]; var b = Object.fromEntries(a);
_.fromPairs
var addonDefinitions = { a: 1, b: 2, c: 3 }; var definitionsTupleArray = []; Object.entries(addonDefinitions).forEach(([definitionId, definition]) => { definitionsTupleArray.push([definitionId, definition]); }); var b = _.fromPairs(definitionsTupleArray);
Object.assign
var obj = {}; Object.assign(obj, { a: 1 }); Object.assign(obj, { b: 2 }); Object.assign(obj, { c: 3 });
Object spread
let obj = {}; obj = { ...obj, ...{ a: 1 }}; obj = { ...obj, ...{ b: 2 }}; obj = { ...obj, ...{ c: 3 }};