refactor: use lightweight token for chip avatar, remove and trailing icon#19693
Merged
mmalerba merged 2 commits intoangular:lightweight-token-optimizationsfrom Jun 19, 2020
Conversation
…icon Currently `MatChip` always causes `MatChipAvatar`, `MatChipRemove` and `MatChipTrailingIcon` to be retained. These are optional parts of a chip and shouldn't be retained always. The retention of these classes wasn't noticeable in View Engine as no factories were generated for directives. With Ivy though, factories and definitions are generated for these directives and a size increase is noticeable. We should use lightweight tokens for querying of those directives. That will improve tree-shaking for the case where not all of these parts are used. If all parts are used, the app will slightly increase due to the provided injection tokens, but that is of average 150b, while the savings are of ~800b in the common case. Related to: angular#19576
devversion
added a commit
to devversion/material2
that referenced
this pull request
Jun 22, 2020
…icon (angular#19693) * build: add size test for basic chip-list with chip * refactor: use lightweight token for chip avatar, remove and trailing icon Currently `MatChip` always causes `MatChipAvatar`, `MatChipRemove` and `MatChipTrailingIcon` to be retained. These are optional parts of a chip and shouldn't be retained always. The retention of these classes wasn't noticeable in View Engine as no factories were generated for directives. With Ivy though, factories and definitions are generated for these directives and a size increase is noticeable. We should use lightweight tokens for querying of those directives. That will improve tree-shaking for the case where not all of these parts are used. If all parts are used, the app will slightly increase due to the provided injection tokens, but that is of average 150b, while the savings are of ~800b in the common case. Related to: angular#19576
devversion
added a commit
that referenced
this pull request
Jun 22, 2020
…icon (#19693) * build: add size test for basic chip-list with chip * refactor: use lightweight token for chip avatar, remove and trailing icon Currently `MatChip` always causes `MatChipAvatar`, `MatChipRemove` and `MatChipTrailingIcon` to be retained. These are optional parts of a chip and shouldn't be retained always. The retention of these classes wasn't noticeable in View Engine as no factories were generated for directives. With Ivy though, factories and definitions are generated for these directives and a size increase is noticeable. We should use lightweight tokens for querying of those directives. That will improve tree-shaking for the case where not all of these parts are used. If all parts are used, the app will slightly increase due to the provided injection tokens, but that is of average 150b, while the savings are of ~800b in the common case. Related to: #19576
devversion
added a commit
to devversion/material2
that referenced
this pull request
Jun 23, 2020
…icon (angular#19693) * build: add size test for basic chip-list with chip * refactor: use lightweight token for chip avatar, remove and trailing icon Currently `MatChip` always causes `MatChipAvatar`, `MatChipRemove` and `MatChipTrailingIcon` to be retained. These are optional parts of a chip and shouldn't be retained always. The retention of these classes wasn't noticeable in View Engine as no factories were generated for directives. With Ivy though, factories and definitions are generated for these directives and a size increase is noticeable. We should use lightweight tokens for querying of those directives. That will improve tree-shaking for the case where not all of these parts are used. If all parts are used, the app will slightly increase due to the provided injection tokens, but that is of average 150b, while the savings are of ~800b in the common case. Related to: angular#19576
jelbourn
pushed a commit
that referenced
this pull request
Jun 29, 2020
…icon (#19693) * build: add size test for basic chip-list with chip * refactor: use lightweight token for chip avatar, remove and trailing icon Currently `MatChip` always causes `MatChipAvatar`, `MatChipRemove` and `MatChipTrailingIcon` to be retained. These are optional parts of a chip and shouldn't be retained always. The retention of these classes wasn't noticeable in View Engine as no factories were generated for directives. With Ivy though, factories and definitions are generated for these directives and a size increase is noticeable. We should use lightweight tokens for querying of those directives. That will improve tree-shaking for the case where not all of these parts are used. If all parts are used, the app will slightly increase due to the provided injection tokens, but that is of average 150b, while the savings are of ~800b in the common case. Related to: #19576
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Currently
MatChipalways causesMatChipAvatar,MatChipRemoveandMatChipTrailingIconto be retained. These are optional parts of a chip andshouldn't be retained always. The retention of these classes wasn't noticeable
in View Engine as no factories were generated for directives. With Ivy though,
factories and definitions are generated for these directives and a size increase
is noticeable.
We should use lightweight tokens for querying of those directives. These tokens
can be considered a reference to the actual directives. That allows us to query
for these directives in content queries, or DI without the risk of retaining the
full classes w/ factories/definitions attached.
That helps with the case where not all of the optional chip parts are used. If all
parts are used, the app will slightly increase due to the provided injection tokens,
but that is of ~150b, while the savings are of ~800b in the common case. The size
benefit is even more noticeable in the MDC-based implementation of chips
as the directives contain a lot more logic w/ MDC foundations.
Related to: #19576