Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object.fromEntries vs reduce without toString
(version: 0)
Comparing performance of:
Object.fromEntries vs Reduce (reuse object) vs Reduce (creating temporary objects)
Created:
5 years ago
by:
Guest
Jump to the latest result
Script Preparation code:
var data = { ...Array.from(Array(10000).keys()) };
Tests:
Object.fromEntries
Object.fromEntries(Object.entries(data).map((key, value) => [key, value]));
Reduce (reuse object)
Object.entries(data).reduce((acc, [k, v]) => { acc[k] = v; return acc; }, {});
Reduce (creating temporary objects)
Object.entries(data).reduce((acc, [k, v]) => ({ ...acc, [k]: v }), {});
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (3)
Previous results
Fork
Test case name
Result
Object.fromEntries
Reduce (reuse object)
Reduce (creating temporary objects)
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:
reduce (immutable) vs map + fromEntries
Object.fromEntries vs create temp object vs Array.reduce
Map & Object.fromEntries vs reduce
Object.fromEntries on array vs reduce on array
Object.fromEntries vs reduce round 2
Comments
Confirm delete:
Do you really want to delete benchmark?