array.filter.unique vs new set

JavaScript performance comparison

Revision 22 of this test case created by Dekus

Preparation code

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

      
<script>
Benchmark.prototype.setup = function() {
  let array = [];
  
  for (let i = 0; i < 1000; i++) {
    array.push(Math.floor(Math.random() * 100));
  }
  
  

};
</script>

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in CCBot 2.0.0 / Other 0.0.0
Test Ops/sec
new set
[...new Set(array)]
pending…
lodash unique
_.uniq(array)
pending…

Compare results of other browsers

Revisions

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

0 Comments