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

Avoid double walking of all modules #28

Merged
merged 2 commits into from
Jun 20, 2016
Merged

Conversation

kratiahuja
Copy link

Currently this addon walks all of the modules twice in order to determine the modules that are initializers and instance initializers. We can squash the map and filter loops into one.

This PR addresses that.

cc: @chadhietala

Currently this addon walks all of the modules twice in order to determine the modules that are initializers and instance initializers. We can squash the `map` and `filter` loops into one.

This PR addresses that.
}
}

deps.forEach(function(dep) {
Copy link
Member

Choose a reason for hiding this comment

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

Why not go even further and remove this forEach? Seems like it's logic could be moved into the if (matches...) { block above. Would also allow getting rid of deps which doesn't seem to be used for anything other than storing a temporary list modules.

Copy link
Author

Choose a reason for hiding this comment

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

It wouldn't make a much difference except of using a small temp array. The deps array is going to much much smaller than the all modules array. In anycase, I have updated and squashed everything into one loop.

Currently this addon walks all of the modules twice in order to determine the modules that are initializers and instance initializers. We can squash the `map` and `filter` loops into one.

This PR addresses that.
@chadhietala chadhietala merged commit 1b0d7e4 into ember-cli:master Jun 20, 2016
@chadhietala
Copy link
Member

CI is unrelated.

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