Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Why not Lo-dash? #5

Open
jared83 opened this issue Mar 7, 2018 · 3 comments
Open

Why not Lo-dash? #5

jared83 opened this issue Mar 7, 2018 · 3 comments

Comments

@jared83
Copy link

jared83 commented Mar 7, 2018

Wouldn't performance of eventemitter4 improve by replacing underscore with the (generally more performant) lo-dash library? Or does it rely on some specific underscore functions that lo-dash doesn't offer?

@eriksank
Copy link
Owner

eriksank commented Mar 7, 2018

Well, at first glance, underscore or lo-dash are very similar, You would really have to know the very specifics of the implementation as to why the one would be better than the other (better performance, more interesting API ...); which is something that I have never investigated.

If there are fixes possible in underscore, based on lo-dash (or the other way around), then I think that it is rather something between them to discuss, unless it they do not agree, or possibly do not even like each other (which quite often happens in fork situations).

So, yes, it is certainly possible that lo-dash has better performance than underscore (or the other way around), but I have actually never tried to investigate that. If I remember it right, they are quite API compatible, aren't they?

@jared83
Copy link
Author

jared83 commented Mar 7, 2018

Well, here it says:

...Underscore and Lo-Dash provide similar functionality. Lo-Dash’s API is a superset of Underscore’s. It provides everything that Underscore does, along with a few additional helper functions. Lo-Dash can generally serve as a drop-in replacement for Underscore with no changes;

so if this is true then replacing underscore with Lo-Dash in eventemitter4 should be as easy as

- _=require('underscore');
+ _=require('lodash');

@jared83
Copy link
Author

jared83 commented Mar 7, 2018

As to what performance impact such replacement would make, I guess it depends largely on which / how eventemitter4 uses underscore functions. This would have to be tested :)
Considering how trivial change to Lo-Dash potentially is, it could be worth giving it a shot and a test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants