Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
FAQ
Register
Log In
Run results for:
Object.fromEntries vs reduce vs property assignment vs Map
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Android 13; Mobile; rv:142.0) Gecko/142.0 Firefox/142.0
Browser:
Firefox Mobile 142
Operating system:
Android
Device Platform:
Mobile
Date tested:
one year ago
Benchmark engine:
Benchmark.js
Reduce
6K/s
Property Assignment
5K/s
Object.fromEntries
3K/s
Map
2K/s
View exact numbers
Test name
Executions per second
✓
Reduce
5,947 Ops/sec
Property Assignment
5,327 Ops/sec
Object.fromEntries
2,717 Ops/sec
Map
1,717 Ops/sec
Script Preparation code:
var keys = Array(10000).fill(null).map((val, index) => index);
Tests:
Object.fromEntries
Object.fromEntries(keys.map((key) => [key, null]));
Reduce
keys.reduce((acc, k) => { acc[k] = null; return acc; }, {});
Property Assignment
const newObj = {}; keys.forEach((k) => { newObj[k] = null; });
Map
const newMap = new Map(); keys.forEach((k) => { newMap.set(k, null); });