chaplinjs / chaplin

HTML5 application architecture using Backbone.js
http://chaplinjs.org
Other
2.85k stars 232 forks source link

Lodash as default in Chaplin? #219

Closed starkovv closed 12 years ago

starkovv commented 12 years ago

What core dev-team thinks about to change Underscore to Lodash as default in Chaplin?

paulmillr commented 12 years ago

I won't really mind about its inclusion. +0

andriijas commented 12 years ago

pros:

cons:

molily commented 12 years ago

Chaplin is a separate library that does not ship with either Underscore or Lodash. The user has to obtain these dependencies separately. Only the test suite needs to contain a copy of jQuery, Backbone, Underscore, Require.js and the testing libs. But this is just the test setup. Users shouldn’t just use our copies of the external libraries.

We can just state in the docs that Lodash is an option. In fact we’re already doing that: https://github.com/chaplinjs/chaplin#dependencies

andriijas commented 12 years ago

While on the subject - which one of them do you guys prefer (personally not in the behalf of Chaplin)?

Sent from my frank phone, mhm

On Thursday 18 October 2012 at 19:51, Mathias Schäfer wrote:

Chaplin is a separate library that does not ship with either Underscore or Lodash. The user has to obtain these dependencies separately. Only the test suite needs to contain a copy of jQuery, Backbone, Underscore, Require.js and the testing libs. But this is just the test setup. Users shouldn’t just use our copies of the external libraries. We can just state in the docs that Lodash is an option. In fact we’re already doing that: https://github.com/chaplinjs/chaplin#dependencies

— Reply to this email directly or view it on GitHub (https://github.com/chaplinjs/chaplin/issues/219#issuecomment-9573989).

molily commented 12 years ago

The source code of Underscore is more readable, while Lodash is optimized for performance. But I doubt that Lodash will speed up your JS application by a significant amount. I’d say 0.5% of the runtime of a big JS app is burned by Underscore. Lodash wil probably take 0.4%. Just an estimate, but I ran the profiler some time ago and saw now significant difference.

All the Chaplin boilerplates come with non-minified Underscore because exceptions in Underscore are easier to understand. Lodash covers some edge cases better, but I think some of the changes were also merged back into Underscore, and I personally don’t care about edge cases which don’t affect me. Lodash has native AMD support, but shim: 'underscore': exports: '_' isn’t a big deal. moviepilot.com uses Underscore, another big project we’re currently working on uses Lodash. Both work fine in production.