underscore _.unique

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/2.2.0/lodash.min.js"></script>
<script>var lodash = _.noConflict();</script>
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script>
Benchmark.prototype.setup = function() {
    var r;
    var array = [];
       
    for (var i = 0; i < 10000; i++) {
      array.push(Math.random()*10000|0);
    }
   
};
</script>

Preparation code output

Test runner

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

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Underscore
r = _.unique(array);
pending…
Lo-Dash
r = lodash.unique(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. Here’s a list of current revisions for this page:

0 comments

Add a comment