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

Backport: Remove unused scope from Walker #1357

Merged
merged 5 commits into from
Oct 22, 2021

Conversation

chriskrycho
Copy link
Contributor

Backport for #1341. Should land after #1355 and #1356.

chriskrycho and others added 5 commits October 22, 2021 09:47
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]>
Previously, this field was being assigned twice: once via direct
assignment in the constructor, and once via the `copy` (previously) or
`Object.assign` (now in this stream of changes) call.
The project already has handling for using `Object.assign` if available
and a polyfill if not; use it!
The `scope` info here is entirely unused in the Glimmer codebase. It may
be used in some AST transforms, but this is fairly unlikely, since it
has only been available since Ember 3.16. Profiling template compilation
highlighted the recursive walking of the whole tree for locals in scope
during syntax parsing as a major cost in CPU usage, so the hope is that
removing this will help.
@rwjblue rwjblue merged commit 8efb85e into glimmerjs:release-0-80 Oct 22, 2021
@chriskrycho chriskrycho deleted the backport-scope-fix branch October 22, 2021 16:17
@rwjblue rwjblue added the bug label Oct 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants