Run details:
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:79.0) Gecko/20100101 Firefox/79.0
Firefox 79
Ubuntu
Desktop
4 years ago
Test name Executions per second
Javascript ES6 includes 11731884.0 Ops/sec
Lodash intersection 3214768.8 Ops/sec
HTML Preparation code:
AخA
 
1
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Script Preparation code:
 
var first = [1, 3, 4, 5, 7];
var second = [2, 3, 5, 6];
Tests:
  • Javascript ES6 includes

     
    first.filter(item => second.includes(item))
  • Lodash intersection

     
    _.intersection(first, second)