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

Glimmer optimizations #11338

Merged
merged 4 commits into from
Jun 4, 2015
Merged

Glimmer optimizations #11338

merged 4 commits into from
Jun 4, 2015

Conversation

tomdale
Copy link
Member

@tomdale tomdale commented Jun 4, 2015

A handful of optimizations for Glimmer. Several of these are tweak that help the V8 JIT to maintain the shape of internal bookkeeping structures. We also fixed a bug that fixes several related issues, where parentView/ownerView were not maintained properly. There were likely teardown bugs related to this. Lastly, we made an improvement to the algorithm used by {{#each}} and other helpers on subsequent re-renders that should reduce the number of DOM operations needed in most situations. (That work happened in the tildeio/htmlbars.)

Apparently, v8’s JIT engineers require that we, as JavaScript developers
perform this very simple transformation, since they do not seem capable
of performing it themselves.
Previously, `parentView` and `ownerView` were set based on `scope`,
which is the “owner tree”. However, it should be based on the
component tree instead.

This commit properly wires up `parentView` and `ownerView`, while
maintaining the correct semantics for the `{{view.foo}}` keyword in
both legacy views and components.
Previously, the `env` was a bag of properties, and got frequently
extended or modified (in largely predictable ways).

The consequence is that even though the environment is conceptually a
single concept, it got treated internally as a megamorphic shapeless
entity. For what it’s worth, this JIT confusion was somewhat mirrored
by a confusion when reading the code: it was never precisely clear what
the `env` would look like from the perspective of a human reader.

This commit changes the environment to be a single class. There are only
two kinds of child environments (a change in the `view` and a change to
`outletState`), and there are now methods on `env` to make that simple
and predictable.

The consequence is that all methods that take an `env` now go down a
fast path when accessing it, and human readers of the code can feel
confident about what the environment looks like.
@runspired
Copy link
Contributor

:D

rwjblue added a commit that referenced this pull request Jun 4, 2015
@rwjblue rwjblue merged commit 308ca40 into master Jun 4, 2015
@rwjblue rwjblue deleted the glimmer-optimizations branch June 4, 2015 01:13
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.

3 participants