Lodash _.uniq vs native new Set()

Benchmark created on


Description

Seeing whether _.uniq() on a large array is more performant than new Set().

Preparation HTML

<script src="
https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js
"></script>

Setup

var arr = [];
for (i = 0; i < 10000; i++) {
	arr.push(i, i);
}

Test runner

Ready to run.

Testing in
TestOps/sec
Lodash _.uniq
var results = _.uniq(arr);
ready
Native Set
var results = new Set(arr);
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.