Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Map entires to object
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/127.0.0.0 Safari/537.36 Edg/127.0.0.0
Browser:
Chrome 127
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Array.from().reduce() reusing object
338409.9 Ops/sec
Array.from(o, mapFn).reduce() reusing object
317173.8 Ops/sec
Entries from Array.from(o, mapFn).reduce()
299599.2 Ops/sec
Script Preparation code:
var data = new Map(Array.from({ length: 25 }, (_, i) => { const v = Math.random() * 1000; return [v.toString(36), { currentValue: v }]; }));
Tests:
Array.from().reduce() reusing object
Array.from(data).reduce((obj, [name, { currentValue }]) => { obj[name] = currentValue; return obj; }, {});
Array.from(o, mapFn).reduce() reusing object
Array.from(data, ([name, { currentValue }]) => [name, currentValue]).reduce((obj, [name, value]) => { obj[name] = value; return obj; }, {});
Entries from Array.from(o, mapFn).reduce()
Object.fromEntries( Array.from(data, ([name, { currentValue }]) => [name, currentValue]), );