Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Object from array: map + Object.fromEntries vs reduce
(version: 1)
Comparing performance of:
Object.fromEntries vs Reduce (reuse object)
Created:
one year ago
by:
Guest
Go to the latest result
Script Preparation code:
var array = Array.from({ length: 10001 }, (_, index) => index);
Tests:
Object.fromEntries
Object.fromEntries(array.map((n) => [`db/path/${n}`, null]));
Reduce (reuse object)
array.reduce((acc, n) => { acc[`db/path/${n}`] = null; return acc; }, {});
Rendered benchmark preparation results:
Suite status:
<idle, ready to run>
Run tests (2)
Previous results
Fork
Test case name
Result
Object.fromEntries
Reduce (reuse object)
Fastest:
N/A
Slowest:
N/A
Latest run results:
Run details:
(Test run date:
one year ago
)
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36
Browser/OS:
Chrome 131 on Linux
View result in a separate tab
Embed
Embed Benchmark Result
Reduce (reuse object)
755/s
Object.fromEntries
443/s
View exact numbers
Test name
Executions per second
✓
Reduce (reuse object)
755 Ops/sec
Object.fromEntries
443 Ops/sec
Related benchmarks
Object.fromEntries vs reduce vs Map - Corrected fromEntries
Object.fromEntries vs reduce v21
Comments
Confirm delete:
Do you really want to delete benchmark?