HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
2
<script src='https://cdn.jsdelivr.net/g/lodash@4(lodash.min.js+lodash.fp.min.js)'></script>
Script Preparation code:
 
var data = Array(10000000).fill({ a: 'a', b: 1 });
Tests:
  • Chain

     
    _.chain(data).filter(f => f.a === 'a').filter(f => f.b === 1).filter(f => f.b + 1 === 2).map(f => f.a).filter(f => f === 'a').value()
  • Native (with &&)

     
    data.filter(f => f.a === 'a' && f.b === 1 && f.b + 1 === 2).map(f => f.a).filter(f => f === 'a')
  • Native (without &&)

     
    data.filter(f => f.a === 'a').filter(f => f.b === 1).filter(f => f.b + 1 === 2).map(f => f.a).filter(f => f === 'a')
  • Flow

     
    _.flow(
      _.filter(f => f.a === 'a'),
      _.filter(f => f.b === 1),
      _.filter(f => f.b + 1 === 2),
      _.map(f => f.a),
      _.filter(f => f === 'a')
    )(data)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Chain
    Native (with &&)
    Native (without &&)
    Flow

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one month ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Safari/537.36
Chrome 133 on Linux
View result in a separate tab
Test name Executions per second
Chain 1.3 Ops/sec
Native (with &&) 1.9 Ops/sec
Native (without &&) 1.0 Ops/sec
Flow 1.1 Ops/sec