Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Reduce array3
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/130.0.0.0 Safari/537.36
Browser:
Chrome 130
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
one year ago
Reduce with var
19K/s
Reduce with empty erray
13K/s
Reduce with filled array
7K/s
Reduce with filled array with null
6K/s
Reduce with new Array
6K/s
View exact numbers
Test name
Executions per second
✓
Reduce with var
18,967 Ops/sec
Reduce with empty erray
12,931 Ops/sec
Reduce with filled array
6,583 Ops/sec
Reduce with filled array with null
5,915 Ops/sec
Reduce with new Array
5,744 Ops/sec
HTML Preparation code:
<!--your preparation HTML code goes here-->
Script Preparation code:
var arr = Array(10_000).fill(1)
Tests:
Reduce with empty erray
arr.reduce((acc, x) => { acc.push(x); return acc; }, []);
Reduce with filled array
arr.reduce((acc, x, index) => { acc[index] = x; return acc; }, new Array(arr.length));
Reduce with filled array with null
arr.reduce((acc, x, index) => { acc[index] = x; return acc; }, new Array(arr.length).fill(null));
Reduce with new Array
arr.reduce((acc, x, index) => { acc[index] = x; return acc; }, new Array());
Reduce with var
const a = new Array(arr.length); arr.reduce((acc, x, index) => { acc[index] = x; return acc; }, a);