Test name | Executions per second |
---|---|
Lodash union | 3862328.5 Ops/sec |
new Set() union | 2896312.2 Ops/sec |
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/lodash@4.17.10/lodash.min.js"></script>
const a = [1, 2, 3, 4, 5]
const b = [3, 4, 5, 6, 7]
const c = _.union(a, b)
const setA = new Set(a)
const setB = new Set(b)
const c = setA.union(setB)