Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
k-v Array to Obj
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36
Browser:
Chrome 127
Operating system:
Windows
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Object.fromEntries
1530.5 Ops/sec
Reduce (same obj)
10835.5 Ops/sec
Reduce (new obj)
45.6 Ops/sec
Script Preparation code:
var arr = Array.from(Array(10000), (x,i) => [i,i]);
Tests:
Object.fromEntries
Object.fromEntries(arr);
Reduce (same obj)
arr .reduce((acc,[k,v]) => { acc[k] = v; return acc }, {})
Reduce (new obj)
arr .reduce((acc,[k,v]) => ({...acc, [k]: v}), {})