Toggle navigation
MeasureThat.net
Create a benchmark
Tools
Feedback
FAQ
Register
Log In
Run results for:
lodash sumBy vs normal sum of 4 values
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/143.0.0.0 Safari/537.36
Browser:
Chrome 143
Operating system:
Mac OS X 10.15.7
Device Platform:
Desktop
Date tested:
3 months ago
Test name
Executions per second
lodash sumBy test
18669200.0 Ops/sec
Normal sum test case
119856232.0 Ops/sec
HTML Preparation code:
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
lodash sumBy test
const [value1, value2, value3, value4] = [1, 2, 3, 4]; const arr = ['value1', 'value2', 'value3', 'value4']; const totalSum = _.sumBy(arr, (field) => { return arr[field] || 0; });
Normal sum test case
const [value1, value2, value3, value4] = [1, 2, 3, 4]; const totalSum = (value1 || 0) + (value2 || 0) + (value3 || 0) + (value4 || 0);