HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/lodash/4.16.2/lodash.min.js"></script>
Script Preparation code:
 
window.array = [1, 4, 3, 4, 2, 2, 1, 5, 3, 5, 1, 4, 3, 4, 2, 2, 1, 5, 3, 5, 1, 4, 3, 4, 2, 2, 1, 5, 3, 5, 1, 4, 3, 4, 2, 2, 1, 5, 3, 5, 1, 4, 3, 4, 2, 2, 1, 5, 3, 5];
Tests:
  • Filter length

     
    const x = _.filter(window.array, i => i === 3).length
  • Sum

     
    const x = _.sumBy(window.array, i => i === 3 ? 1 : 0)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Filter length
    Sum

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 8 years ago)
Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36
Chrome 53 on Windows 7
View result in a separate tab
Test name Executions per second
Filter length 777025.0 Ops/sec
Sum 834411.1 Ops/sec