-
-
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
Component Performance Tweaks #12289
Merged
Merged
Component Performance Tweaks #12289
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
Full details in https://gist.github.com/rwjblue/5d9e7b71fa30f6f45e55.