Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
reduce creation x
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (iPhone; CPU iPhone OS 17_3_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.3.1 Mobile/15E148 Safari/604.1
Browser:
Mobile Safari 17
Operating system:
iOS 17.3.1
Device Platform:
Mobile
Date tested:
2 years ago
Test name
Executions per second
spread insert
0.1 Ops/sec
assign insert
230.3 Ops/sec
map
1815.5 Ops/sec
mutation
3598.6 Ops/sec
tuple
2858.2 Ops/sec
Script Preparation code:
var data = Array.from({ length: 10000 }).map((_, idx) => idx)
Tests:
spread insert
data.reduce((acc, val) => ({ ...acc, [val]: val }), {})
assign insert
data.reduce((acc, val) => Object.assign(acc, {[val]: val}))
map
Object.fromEntries(data.reduce((acc, val) => acc.set(val, val), new Map()))
mutation
data.reduce((acc, val) => acc[val] = val, {})
tuple
Object.fromEntries(data.map((v) => [v, v]))