HTML Preparation code:
AخA
 
1
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
Script Preparation code:
 
var a = [1, 2, 3, 4, 5]
var b = [3, 4, 5, 6, 7]
Tests:
  • _.union

     
    var c = _.union(a, b)
    const d = c.includes(a => a===3)
  • Set()

     
    var c = new Set(a, b)
    const d = c.has(3)
  • Set() convert back to array

    x
     
    var c = new Set(a, b)
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    _.union
    Set()
    Set() convert back to array

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: one year ago)
Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0
Firefox 119 on Linux
View result in a separate tab
Test name Executions per second
_.union 3222084.8 Ops/sec
Set() 2211495.2 Ops/sec
Set() convert back to array 2234821.0 Ops/sec