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

Component Performance Tweaks #12289

Merged
merged 10 commits into from
Sep 4, 2015
Merged

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Sep 4, 2015

This is a rebase/cleanup of #12286.

Performance comparison of initial render performance (mean of 50 runs each) using https://github.com/ef4/initial-render-perf and latest Chrome:

1.12.1 - 105ms
1.13.9 - 194ms
2.0.1 - 163ms
2.1.0-beta.2 - 157ms
canary-a3fb7a1d - 173ms <- Just before this PR.
canary-eeb8ee90 - 138ms <- Including this PR.

Full details in https://gist.github.com/rwjblue/5d9e7b71fa30f6f45e55.

chancancode and others added 10 commits September 3, 2015 13:24
Previously, we tried to restrict which attributes we set eagerly, and
clean up the rest using unknownProperty. However, over time, making that
work correctly has gotten more and more complicated, and the cost of the
laziness is more than the benefits.

This commit goes back to an eager setting strategy, eliminates
unknownProperty and the reliance on _internalDidReceiveAttrs. It leaves
a setter interceptor for propagating sets to mutable cells.
Similar to `meta`, this commit restructures the scope away from
pervasive use of `Object.create` into a custom JavaScript object.

This has two benefits:

1. We only need a single parent pointer, rather than having every map
   inherit from its parent map.
2. v8 penalizes us for using `Object.create` by often assuming we are
   creating something more class-like and eventually blowing up methods
   that use scopes.

Eventually, this scope refactoring will probably replace some of the
hooks in HTMLBars.
This allows us to lazily create the state bucket for each morph, and
avoids creating a ton of extra objects that are unused.
Also, ensure `EMPTY` has the same object shape as `Scope`.
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