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

Fix some lint issues and update airbnb #236

Merged
merged 1 commit into from
Sep 22, 2016
Merged

Fix some lint issues and update airbnb #236

merged 1 commit into from
Sep 22, 2016

Conversation

danielkcz
Copy link
Contributor

@danielkcz danielkcz commented Sep 22, 2016

I've replaced for loops using ++ operator with reduce which I would say is better in general.

Change for a rule "no-use-before-define" allows hoisting of functions which is necessary to pass with green lights :)

Updated airbnb since it was complaining about new version of eslint. Nothing for broken because of that.

for (let i = 0; i < keys.length; i++) {
const key = keys[i];

return Object.keys(src).reduce((result, key) => {
Copy link
Member

Choose a reason for hiding this comment

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

This for loop was a performance optimization.

The problem with reduce is the performance. We are creating one more object (function) and scope. Accessing variables of the upper scope is slower than accessing from own scope.
More info here: https://github.com/petkaantonov/bluebird/wiki/Optimization-killers

Please, revert the loop (and the other one). Stampit has to be fast!

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, but performance is relative till you introduce actual performance tests. I would prefer clarity of code till we know this is a bottleneck...

Copy link
Member

@abhisekp abhisekp Sep 22, 2016

Choose a reason for hiding this comment

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

Isn't that statement applicable for apps and not libraries? 😏

@koresar koresar merged commit beb5f7b into v3_0 Sep 22, 2016
@koresar koresar deleted the v3_0-linting-fixes branch September 22, 2016 14:17
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

Successfully merging this pull request may close these issues.

None yet

3 participants