coffeescript-vs-underscore-vs-lodash

JavaScript performance comparison

Revision 11 of this test case created

Info

Let's compare to naive methods too :)

Preparation code

<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/lodash.js/1.3.1/lodash.min.js"></script>
<script>
var lodash = _.noConflict();
</script>
<script>
Benchmark.prototype.setup = function() {
    var x = 'x';
    var array = Array(100).join(x).split('');
   
    var _ = window._;
    var _chaining = _(array).chain();
   
    var lodash = window.lodash;
    var lodashChaining = _(array);
};
</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
Cofffeescript
//array.filter (offer) -> offer.id == 99

var result = array.filter(function(offer) {
  return offer.id === 99;
});
pending…
Underscore
var result = _(array).detect(function(offer) {
  return offer.id === 99;
});
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