Toggle navigation
MeasureThat
.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
Perf _.groupBy vs native Array.reduce
Go to the benchmark
Embed
Embed Benchmark Result
Run details:
User agent:
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0
Browser:
Chrome 144
Operating system:
Windows
Device Platform:
Desktop
Date tested:
5 months ago
Native Array reduce
9.1M/s
_.groupBy
5.3M/s
View exact numbers
Test name
Executions per second
✓
Native Array reduce
9,064,613 Ops/sec
_.groupBy
5,274,654 Ops/sec
HTML Preparation code:
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/underscore@1.13.1/underscore-umd-min.js"></script>
Tests:
_.groupBy
const a = ["one", "two", "three"]; _.groupBy(a, "length");
Native Array reduce
const a = ["one", "two", "three"]; a.reduce((acc, curr) => { acc[curr.length] = (acc[curr.length] || []); acc[curr.length].push(curr); return acc; }, {});