Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
Feature Requests
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:
2 years ago
Benchmark engine:
Benchmark.js
Map
205K/s
Push
107K/s
Arr.reduce
1K/s
View exact numbers
Test name
Executions per second
✓
Map
205,141 Ops/sec
Push
106,630 Ops/sec
Arr.reduce
1,418 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)