-
Notifications
You must be signed in to change notification settings - Fork 137
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
Prevent redundant toTree wrapping for macros #1213
Prevent redundant toTree wrapping for macros #1213
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Is there something else I should be doing to prevent @embroider/macros included method from getting hit so much?
No, I don't think so. You are getting called (not literally you of course 😉), by EmberCLI, so there is nothing to change that on this side. However I am quite puzzled that include()
is called that much! (>7000x 😱)
I've seen some pretty crazy things like that in big apps. ember-cli creates separate addon instances per consumer. If you have an addon that uses embroider/macros, and that addon is used by 10 other addons, and those addons are each used by 10 other addons, and those addons are used by 10 other addons, embroider/macros will get instantiated 1000 times. |
Yeah that seems to be the situation I'm seeing. I've got ~175 addons recognized by the project, but the recursive blow things up. We've got 37 addons that declare a dependency on ember-classic-decorator which depends on @embroider/macros |
This will still happen once per |
I think that's correct, but that's probably not enough to blow up the stack limit. |
In an app with many addons, we are seeing this wrapping get applied a significant number of times, eventually leading to "Maximum call stack size exceeded" errors when toTree is finally executed.
When I copy the stack trace out of visual code just before the "Maximum call stack size exceeded" error, there are 7364 lines in the stack that match
node_modules/@embroider/macros/src/ember-addon-main.js:56
I think this wrapper only needs to be applied once per app instance. Is there something else I should be doing to prevent
@embroider/macros
included
method from getting hit so much?