HTML Preparation code:
x
 
1
2
<script src='https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.5/lodash.min.js'></script>
Tests:
  • lodash

     
    let arrOfObj = {};
    new Array(0x10000).fill('omg').map((v,k) => arrOfObj[`key${k}`] = v) // max 65536
    const joined = _.filter(arrOfObj, (v, key) => _.includes(['key1', 'key599', 'key2679', 'key60000'], key)).join()
  • es6

     
    let arrOfObj = {};
    new Array(0x10000).fill('omg').map((v,k) => arrOfObj[`key${k}`] = v) // max 65536
    const keys = Object.keys(arrOfObj).map((v, k) => ['key1', 'key599', 'key2679', 'key60000'].includes(v)?k:null).filter(x => x)
    const joined = Object.keys(arrOfObj).filter((v, k) => keys.includes(k)).join()
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    lodash
    es6

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 5 years ago)
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/76.0.3809.132 Safari/537.36
Chrome 76 on Mac OS X 10.14.6
View result in a separate tab
Test name Executions per second
lodash 16.5 Ops/sec
es6 17.8 Ops/sec