HTML Preparation code:
AخA
 
1
<script src="lodash.js"></script>
Script Preparation code:
 
var listOfObjects_1 = [{id: 1, name: '1'}, {id: 2, name: '2'}, {id: 5, name: '5'}]
var listOfObjects_2 = [{id: 1, name: '1'}, {id: 2, name: '2'}, {id: 5, name: '4'}]
Tests:
  • lodash intersectionBy

     
    _.intersectionBy(listOfObjects_1, listOfObjects_2, 'id')
  • array filtering with includes

     
    var ids_1 = listOfObjects_1.map(o => o.id)
    listOfObjects_2.filter(o => ids_1.includes(o.id))
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash intersectionBy
    array filtering with includes

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 3 months ago)
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/132.0.0.0 Safari/537.36
Chrome 132 on Linux
View result in a separate tab
Test name Executions per second
lodash intersectionBy 852457.6 Ops/sec
array filtering with includes 14334470.0 Ops/sec