Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Browser:
Chrome 126
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
2 years ago
Benchmark engine:
Benchmark.js
tuple
3K/s
map
1K/s
mutation
1K/s
assign insert
256/s
spread insert
118/s
View exact numbers
Test name
Executions per second
✓
tuple
2,782 Ops/sec
map
1,362 Ops/sec
mutation
1,096 Ops/sec
assign insert
256 Ops/sec
spread insert
118 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]))