Sitelet https://web.archive.org/web/20231223190349/https://github.com/angular/components/issues/19576
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

Use light-weight injection pattern for optimized tree-shaking/bundle size #19576

Closed
devversion opened this issue Jun 9, 2020 · 1 comment · Fixed by #19736
Closed

Use light-weight injection pattern for optimized tree-shaking/bundle size #19576

devversion opened this issue Jun 9, 2020 · 1 comment · Fixed by #19736
Assignees
Labels
area: many Area label for issues related to many components feature This issue represents a new feature or feature request rather than a bug or bug fix in progress This issue is currently in progress

Comments

@devversion
Copy link
Member

devversion commented Jun 9, 2020 •

With Ivy, factories are directly attached to components, so we production bundles could end up with larger bundles if Angular components/directives are used as predicates for optional queries or DI.

See: angular/angular#36144 and https://github.com/angular/angular-cli/issues/16866.

Here is an example:

export class ListItem {
  constructor(@Optional() navigationList: NavList|null,
              @Optional() actionList: ActionList|null)
}

This will result in both NavList and ActionList being retained in production bundles as soon as the ListItem component/directive is used. It will become worse if NavList and ActionList have their own Angular factory/definition (that will also be retained now).

We need to go through our components and optimize these if they are affected by this issue that is now surfacing (more significantly) with Ivy.

Currently pending PRs:

What we need upstream:

  • NgForm used in MatChipList.
  • FormGroupDirective used in MatChipList
  • NgControl used in MatChipList.

What we should consider in the future?

  • Directionality
  • Using a light-weight token for the DateAdapter for better tree-shaking

Revisit after done:

  • MDC equivalents
@devversion devversion added feature This issue represents a new feature or feature request rather than a bug or bug fix needs triage This issue needs to be triaged by the team and removed needs triage This issue needs to be triaged by the team labels Jun 9, 2020
@devversion devversion self-assigned this Jun 9, 2020
@devversion devversion added the in progress This issue is currently in progress label Jun 9, 2020
devversion added a commit to devversion/material2 that referenced this issue Jun 9, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 9, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 9, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 9, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 9, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 10, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 10, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
@andrewseguin andrewseguin added the area: many Area label for issues related to many components label Jun 12, 2020
devversion added a commit to devversion/material2 that referenced this issue Jun 12, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 12, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
The date range picker could be used outside the `MatFormField`
component in practice. Right now though, the date-picker input
always has a hard-reference on the `MatFormField` component, causing
it to be retained. This would be the same in View Engine, but with
Ivy this signifies a larger size issue as factories/definitions are
directly attached to the component.

To allow for better tree-shaking / optimizations, we use the form-field
light-weight injection token, so that the date range picker can be used
outside of a form-field with minimal cost.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
The date range picker could be used outside the `MatFormField`
component in practice. Right now though, the date-picker input
always has a hard-reference on the `MatFormField` component, causing
it to be retained. This would be the same in View Engine, but with
Ivy this signifies a larger size issue as factories/definitions are
directly attached to the component.

To allow for better tree-shaking / optimizations, we use the form-field
light-weight injection token, so that the date range picker can be used
outside of a form-field with minimal cost.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
Angular Material supports lazy content for menus. It does this
by querying for the `MatMenuContent` directive in the `MatMenu`
component. This is problematic though as it always causes
`MatMenuContent` to be retained as its used as actual query predicate
token.

To solve this, we use a lightweight injection token for querying
the lazy content (if present). This optimizes applications using
the Angular Material menu without lazy content.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
The Angular Material `MatRadioButton` component currently
optionally injects the `MatRadioGroup`. This causes the
`MatRadioGroup` implementation to be always retained in
application bundles.

This is problematic as the use of radio groups is not
always required. i.e. it's valid to use a standalone
radio button. In those cases, we do not want to retain
the radio group implementation unnecessarily.

This has always been an issue, but the issue became
more significant in Ivy where component factory and definitions
are attached directly to the `MatRadioGroup` class (resulting
in a more significant size increase).

We fix this by using a lightweight token for injecting the parent
radio group optionally. This solves the retention issue if a standalone
radio button is used.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 15, 2020
The Angular Material `MatRadioButton` component currently
optionally injects the `MatRadioGroup`. This causes the
`MatRadioGroup` implementation to be always retained in
application bundles.

This is problematic as the use of radio groups is not
always required. i.e. it's valid to use a standalone
radio button. In those cases, we do not want to retain
the radio group implementation unnecessarily.

This has always been an issue, but the issue became
more significant in Ivy where component factory and definitions
are attached directly to the `MatRadioGroup` class (resulting
in a more significant size increase).

We fix this by using a lightweight token for injecting the parent
radio group optionally. This solves the retention issue if a standalone
radio button is used.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 16, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 16, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 16, 2020
The date range picker could be used outside the `MatFormField`
component in practice. Right now though, the date-picker input
always has a hard-reference on the `MatFormField` component, causing
it to be retained. This would be the same in View Engine, but with
Ivy this signifies a larger size issue as factories/definitions are
directly attached to the component.

To allow for better tree-shaking / optimizations, we use the form-field
light-weight injection token, so that the date range picker can be used
outside of a form-field with minimal cost.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
Angular Material supports lazy content for menus. It does this
by querying for the `MatMenuContent` directive in the `MatMenu`
component. This is problematic though as it always causes
`MatMenuContent` to be retained as its used as actual query predicate
token.

To solve this, we use a lightweight injection token for querying
the lazy content (if present). This optimizes applications using
the Angular Material menu without lazy content.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The date range picker could be used outside the `MatFormField`
component in practice. Right now though, the date-picker input
always has a hard-reference on the `MatFormField` component, causing
it to be retained. This would be the same in View Engine, but with
Ivy this signifies a larger size issue as factories/definitions are
directly attached to the component.

To allow for better tree-shaking / optimizations, we use the form-field
light-weight injection token, so that the date range picker can be used
outside of a form-field with minimal cost.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
Currently the `CdkDropList` directive always retains the
`CdkDropListGroup` directive. This is not desired as the
drop list group is not necessarily always used in combination
with a drop list.

Additionally, the `CdkDrag` directive always retains the
`CdkDragHandle`, `CdkDragPlaceholder` and `CdkDragPreview`
directives. This is neither desired because a handle, placeholder
or preview can be consumed optionally. We should only bring those
directives into applications when actually needed.

Size measurements show that this saves around ~1.3kb if only
a drop list and `cdkDrag` is used. The downside is that we add
up ~200b if _all_ directives of the drag-drop module are used.

Given the drag-drop has a size of around 45kb, the 1.3kb size
improvement in the common case should be good (~3% reduction).

Related to angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The `CdkAccordionItem` currently always brings in the `CdkAccordion`
class. This is not desired as an accordion item could be used
outside of a `<cdk-accordion>`. In those cases, we do not want
to retain the accordion class w/ metadata unnecessarily.

This also affects the `MatExpansionPanel` as it extends
from the `CdkAccordionItem` and therefore always brings in
the `CdkAccordion` list unnecessarily right now.

Related to angular#19576.
devversion added a commit to devversion/material2 that referenced this issue 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
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The Angular Material tab group currently always retains `MatTabContent`
and `MatTabLabel`. These are optional features of the tabs module and
should only be retained when needed.

To achieve this, we use lightweight tokens instead of the actual
implementations when querying for a lazy content or label.

This signifies an improvement of ~500b in the common case, and
an increase (due to the lightweight tokens being provided) in
the advanced case of ~140b.

Related to angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The Angular Material always retains the `MatSelectTrigger`
class. This is not ideal as this is an optional part
of the select. The class itself is not large enough
to contribute to any noticeable size impact, even with
Ivy where factories/definitions are directly attached, but
for the sake of completeness, and because custom triggers
are assumed to be uncommon, a lightweight token is used for
a small micro-optimization in the common case.

Related to angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The Angular Material tab group currently always retains `MatTabContent`
and `MatTabLabel`. These are optional features of the tabs module and
should only be retained when needed.

To achieve this, we use lightweight tokens instead of the actual
implementations when querying for a lazy content or label.

This signifies an improvement of ~500b in the common case, and
an increase (due to the lightweight tokens being provided) in
the advanced case of ~140b.

Related to angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The Angular Material always retains the `MatSelectTrigger`
class. This is not ideal as this is an optional part
of the select. The class itself is not large enough
to contribute to any noticeable size impact, even with
Ivy where factories/definitions are directly attached, but
for the sake of completeness, and because custom triggers
are assumed to be uncommon, a lightweight token is used for
a small micro-optimization in the common case.

Related to angular#19576.
devversion added a commit to devversion/material2 that referenced this issue Jun 23, 2020
The Angular Material always retains the `MatSelectTrigger`
class. This is not ideal as this is an optional part
of the select. The class itself is not large enough
to contribute to any noticeable size impact, even with
Ivy where factories/definitions are directly attached, but
for the sake of completeness, and because custom triggers
are assumed to be uncommon, a lightweight token is used for
a small micro-optimization in the common case.

Related to angular#19576.
devversion added a commit that referenced this issue Jun 23, 2020
The Angular Material tab group currently always retains `MatTabContent`
and `MatTabLabel`. These are optional features of the tabs module and
should only be retained when needed.

To achieve this, we use lightweight tokens instead of the actual
implementations when querying for a lazy content or label.

This signifies an improvement of ~500b in the common case, and
an increase (due to the lightweight tokens being provided) in
the advanced case of ~140b.

Related to #19576.
devversion added a commit that referenced this issue Jun 23, 2020
The Angular Material always retains the `MatSelectTrigger`
class. This is not ideal as this is an optional part
of the select. The class itself is not large enough
to contribute to any noticeable size impact, even with
Ivy where factories/definitions are directly attached, but
for the sake of completeness, and because custom triggers
are assumed to be uncommon, a lightweight token is used for
a small micro-optimization in the common case.

Related to #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The Angular Material `MatRadioButton` component currently
optionally injects the `MatRadioGroup`. This causes the
`MatRadioGroup` implementation to be always retained in
application bundles.

This is problematic as the use of radio groups is not
always required. i.e. it's valid to use a standalone
radio button. In those cases, we do not want to retain
the radio group implementation unnecessarily.

This has always been an issue, but the issue became
more significant in Ivy where component factory and definitions
are attached directly to the `MatRadioGroup` class (resulting
in a more significant size increase).

We fix this by using a lightweight token for injecting the parent
radio group optionally. This solves the retention issue if a standalone
radio button is used.

Related to: #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
Angular Material supports lazy content for menus. It does this
by querying for the `MatMenuContent` directive in the `MatMenu`
component. This is problematic though as it always causes
`MatMenuContent` to be retained as its used as actual query predicate
token.

To solve this, we use a lightweight injection token for querying
the lazy content (if present). This optimizes applications using
the Angular Material menu without lazy content.

Related to: #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The date range picker could be used outside the `MatFormField`
component in practice. Right now though, the date-picker input
always has a hard-reference on the `MatFormField` component, causing
it to be retained. This would be the same in View Engine, but with
Ivy this signifies a larger size issue as factories/definitions are
directly attached to the component.

To allow for better tree-shaking / optimizations, we use the form-field
light-weight injection token, so that the date range picker can be used
outside of a form-field with minimal cost.

Related to: #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The `MatButtonToggleGroup` component is not always used in applications. e.g.
it's an optional part, and standalone button toggles are totally valid.

Currently though, we always reference the `MatButtonToggleGroup` component
directly as a value, and it will be retained in applications regardless
of the usage.

We can improve this by providing a light-weight injection token for
the button-toggle group that we can then use DI injection to avoid
full retention of the class.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The `MatOptgroup` component is not always used in applications. e.g.
it's an optional part of the autocomplete or select. Currently though,
we always reference the `MatOpgroup` component directly as a value,
and it will be retained in applications regardless of the usage.

We can improve this by providing a light-weight injection token for
the optgroup that we can then use in queries or optional DI injection.

This obviously was already an issue in View Engine too, but it became
significantly worse in Ivy as factories are now directly attached to
the component class.

Related to: #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
Currently the `CdkDropList` directive always retains the
`CdkDropListGroup` directive. This is not desired as the
drop list group is not necessarily always used in combination
with a drop list.

Additionally, the `CdkDrag` directive always retains the
`CdkDragHandle`, `CdkDragPlaceholder` and `CdkDragPreview`
directives. This is neither desired because a handle, placeholder
or preview can be consumed optionally. We should only bring those
directives into applications when actually needed.

Size measurements show that this saves around ~1.3kb if only
a drop list and `cdkDrag` is used. The downside is that we add
up ~200b if _all_ directives of the drag-drop module are used.

Given the drag-drop has a size of around 45kb, the 1.3kb size
improvement in the common case should be good (~3% reduction).

Related to #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The `CdkAccordionItem` currently always brings in the `CdkAccordion`
class. This is not desired as an accordion item could be used
outside of a `<cdk-accordion>`. In those cases, we do not want
to retain the accordion class w/ metadata unnecessarily.

This also affects the `MatExpansionPanel` as it extends
from the `CdkAccordionItem` and therefore always brings in
the `CdkAccordion` list unnecessarily right now.

Related to #19576.
jelbourn pushed a commit that referenced this issue 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
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The Angular Material tab group currently always retains `MatTabContent`
and `MatTabLabel`. These are optional features of the tabs module and
should only be retained when needed.

To achieve this, we use lightweight tokens instead of the actual
implementations when querying for a lazy content or label.

This signifies an improvement of ~500b in the common case, and
an increase (due to the lightweight tokens being provided) in
the advanced case of ~140b.

Related to #19576.
jelbourn pushed a commit that referenced this issue Jun 29, 2020
The Angular Material always retains the `MatSelectTrigger`
class. This is not ideal as this is an optional part
of the select. The class itself is not large enough
to contribute to any noticeable size impact, even with
Ivy where factories/definitions are directly attached, but
for the sake of completeness, and because custom triggers
are assumed to be uncommon, a lightweight token is used for
a small micro-optimization in the common case.

Related to #19576.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: many Area label for issues related to many components feature This issue represents a new feature or feature request rather than a bug or bug fix in progress This issue is currently in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants