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

Replace lodash's each/map with ES5 native forEach/map #689

Merged
merged 2 commits into from
Oct 15, 2016

Conversation

astorije
Copy link
Member

And use some fat arrows because these are the good kind of fats.

@astorije astorije added the Type: Feature Tickets that describe a desired feature or PRs that add them to the project. label Oct 12, 2016
@MaxLeiter
Copy link
Member

MaxLeiter commented Oct 12, 2016

Maybe worth noting that according to this, lodash's forEach is faster than the native implementation

@astorije
Copy link
Member Author

It's slightly more complicated than that: it will be faster on some browsers and similar in others because of Lodash's implementation and how browsers implement forEach.

That being said, while it's good to keep in mind in case this ever becomes a bottleneck, I don't think we should worry about that. While we're at it, why not using for and while loops :)

Thanks for bringing that up though, I didn't know that before you posted it.

@xPaw
Copy link
Member

xPaw commented Oct 13, 2016

Keep in mind we only use lodash on the server, so the nide is the only engine. 👍 for using native methods when possible.


chan.users.push(user);
});
data.users.forEach(u => chan.users.push(new User(u, network.prefixLookup)));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map should work fine here

Copy link
Member

@xPaw xPaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haz test webhuks.

Copy link
Member

@xPaw xPaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another test!

Copy link
Member

@xPaw xPaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

review comment

@xPaw xPaw added this to the 2.1.0 milestone Oct 15, 2016
@astorije
Copy link
Member Author

Re: micro-change performance, on that note I watched a nice talk about how JSPerf-based conclusions are often not applicable :) https://www.youtube.com/watch?v=65-RbBwZQdU

@astorije astorije merged commit 5598da7 into master Oct 15, 2016
@astorije astorije deleted the astorije/es5-es6-love branch October 15, 2016 20:32
matburnham pushed a commit to matburnham/lounge that referenced this pull request Sep 6, 2017
Replace lodash's each/map with ES5 native forEach/map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Tickets that describe a desired feature or PRs that add them to the project.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants