Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Arr Reduce vs push/map
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36
Browser:
Chrome 128
Operating system:
Linux
Device Platform:
Desktop
Date tested:
one year ago
Test name
Executions per second
Arr.reduce
1417.6 Ops/sec
Push
106629.6 Ops/sec
Map
205141.0 Ops/sec
Script Preparation code:
const arr = [] for (let i = 0; i < 1000; i++){arr.push(i)}
Tests:
Arr.reduce
const arr = [] for (let i = 0; i < 1000; i++){arr.push(i)} const newArr = arr.reduce((acc,curr) => [...acc, curr], [])
Push
const arr = [] for (let i = 0; i < 1000; i++){arr.push(i)} const newArr = [] arr.forEach((curr) => newArr.push(curr))
Map
const arr = [] for (let i = 0; i < 1000; i++){arr.push(i)} const newArr = arr.map((curr) => curr)