-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
[Bug] Template compilation significantly slower starting in Ember 3.25 #19750
Comments
The updates to the template compiler made in support of strict mode introduced a number of uses of private class fields, some of them in hot paths. Since `tsc` currently transpiles private class fields to `WeakMap`s for all values of `target` lower than `ESNEXT`, this results in dramatically higher memory usage and garbage collection than in the previous version of the template compiler. This in turn causes at least a large portion of the regression noted in emberjs/ember.js#19750. Here, we replace *all* private class fields with `_` private fields, which substantially (thought not 100%) closed the gap with the original. Co-authored-by: Brenden Palmer <[email protected]>
The updates to the template compiler made in support of strict mode introduced a number of uses of private class fields, some of them in hot paths. Since `tsc` currently transpiles private class fields to `WeakMap`s for all values of `target` lower than `ESNEXT`, this results in dramatically higher memory usage and garbage collection than in the previous version of the template compiler. This in turn causes at least a large portion of the regression noted in [emberjs/ember.js#19750][1]. [1]: emberjs/ember.js#19750 Here, we replace *all* private class fields with `_` private fields, which substantially (thought not 100%) closed the gap with the original. Co-authored-by: Brenden Palmer <[email protected]>
The updates to the template compiler made in support of strict mode introduced a number of uses of private class fields, some of them in hot paths. Although all supported versions of Node support private class fields, `tsc` transpiles private class fields to `WeakMap`s for all values of `target` lower than `ESNEXT`. As a result, the use of private class fields results in dramatically higher memory usage and garbage collection than in the previous version of the template compiler. This in turn causes at least a large portion of the regression noted in [emberjs/ember.js#19750][1]. [1]: emberjs/ember.js#19750 Here, we replace *all* private class fields with `_` private fields, which substantially (thought not 100%) closed the gap with the original. Co-authored-by: Brenden Palmer <[email protected]>
A status update for anyone following along with this: we've landed a number of improvements on the VM—
—but unfortunately, while they seem to be improving both CPU and memory impact in our repro repo they are not having a meaningful effect in our app, because all the impact from them is being swamped by increased memory pressure, in two ways:
I currently suspect that this is simply the result of all the extra allocation involved with having two versions of the AST in the VM—the duplication resulting in both the higher memory pressure and associated slowdowns across other functionality and the extra GC when we drop the v1 AST after normalization. I'm going to try to validate that hypothesis today, and if I do, we’ll reevaluate next steps then. Footnotes
|
Update on the above: I had a measurement failure,1 and the cumulative effective of those changes was actually substantial within our app:
I will be opening back-ports of those fixes to the Glimmer v0.80 branch today, and we will then aim to land a bug fix release with those changes on Ember 3.28. I'll mark that bug fix PR as resolving this issue, so it should be closed within the next few days! Footnotes
|
The updates to the template compiler made in support of strict mode introduced a number of uses of private class fields, some of them in hot paths. Although all supported versions of Node support private class fields, `tsc` transpiles private class fields to `WeakMap`s for all values of `target` lower than `ESNEXT`. As a result, the use of private class fields results in dramatically higher memory usage and garbage collection than in the previous version of the template compiler. This in turn causes at least a large portion of the regression noted in [emberjs/ember.js#19750][1]. [1]: emberjs/ember.js#19750 Here, we replace *all* private class fields with `_` private fields, which substantially (thought not 100%) closed the gap with the original. Co-authored-by: Brenden Palmer <[email protected]>
We fixed this particular thing, so I'm closing this. Thanks again to everyone who helped get it sorted! |
🐞 Describe the Bug
We recently upgraded a large Ember application (with nearly 4k template files) from 3.24 to 3.28, and noticed that our build speed has regressed (more than a 10% regression) quite a bit due to this upgrade. After some debugging we've traced the issue back to 3.25 where it seems template compilation is significantly slower.
🔬 Minimal Reproduction
To reproduce this:
yarn install
yarn bench
😕 Actual Behavior
Slower template compilation after upgrading to Ember 3.28 (the regression looks to be introduced as part of Ember 3.25)
🤔 Expected Behavior
(Ideally) no regression to template compilation speeds
🌍 Environment
The text was updated successfully, but these errors were encountered: