lodash groupBy vs underscrore groupBy

JavaScript performance comparison

Revision 2 of this test case created

Preparation code

<script src="//documentcloud.github.com/underscore/underscore-min.js">
</script>
<script>
window.underscore = _.noConflict();
</script>
<script src="http://rawgithub.com/bestiejs/lodash/master/dist/lodash.min.js">
</script>
<script>
window.lodash = _.noConflict();
</script>
<script>
Benchmark.prototype.setup = function() {
    var lodash = window.lodash,
        underscore = window.underscore;
   
    var test = [{
      name: 'alpha',
      value: 10
    }, {
      name: 'beta',
      value: 15
    }, {
      name: 'alpha',
      value: 20
    }, {
      name: 'alpha',
      value: 23
    }, {
      name: 'gamma',
      value: 12
    }, {
      name: 'alpha',
      value: 10
    }, {
      name: 'alpha',
      value: 10
    }, {
      name: 'beta',
      value: 19
    }, {
      name: 'beta',
      value: 8
    }, {
      name: 'gamma',
      value: 11
    }];
};
</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
underscore.groupBy(test, 'name');
pending…
lodash
lodash.groupBy(test, 'name');
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