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:
2 months ago
Test name
Executions per second
_.groupBy
5274654.0 Ops/sec
Native Array reduce
9064613.0 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; }, {});