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:
x
 
var fp = _.noConflict();
var data = Array(10000000).fill({ a: Math.random() < 0.5 ? 'a' : 'b', b: Math.random() * 100000 });
Tests:
  • Chain

     
    _.chain(data).filter(f => f.a === 'a').filter(f => f.b > 50000).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 > 50000 && f.b + 1 === 2).map(f => f.a).filter(f => f === 'a')
  • Native (without &&)

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

     
    fp.flow(
      fp.filter(f => f.a === 'a'),
      fp.filter(f => f.b > 50000),
      fp.filter(f => f.b + 1 === 2),
      fp.map(f => f.a),
      fp.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: 4 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 11_0_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.80 Safari/537.36
Chrome 86 on Mac OS X 11.0.0
View result in a separate tab
Test name Executions per second
Chain 17.9 Ops/sec
Native (with &&) 6.8 Ops/sec
Native (without &&) 6.7 Ops/sec
Flow 8.0 Ops/sec