Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Object.fromEntries vs reduce
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 16; Mobile; rv:147.0) Gecko/147.0 Firefox/147.0
Browser:
Firefox Mobile 147
Operating system:
Android
Device Platform:
Mobile
Date tested:
5 months ago
Reduce (reuse object)
630/s
Object.fromEntries
69/s
Reduce (creating temporary objects)
0/s
View exact numbers
Test name
Executions per second
✓
Reduce (reuse object)
630 Ops/sec
Object.fromEntries
69 Ops/sec
Reduce (creating temporary objects)
0 Ops/sec
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.toString(); return acc; }, {});
Reduce (creating temporary objects)
Object.entries(data).reduce((acc, [k, v]) => ({ ...acc, [k]: v.toString() }), {});