Skip to content

perf(cdk/overlay): add tree-shakeable alternatives for overlay APIs #30904

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

crisbeto
Copy link
Member

Currently all the overlay APIs go through the Overlay service which means that even if an app only uses the fairly simple global positioning strategy, they'd still bring in all the code for the complex flexible positioning strategy.

These changes break up the APIs into constructor functions that can be tree shaken separately.

Note that I'll send follow-up PRs to roll this out in Material in order to see the full benefits.

From a simple test of a an ng new app that only uses MatTooltip, this shaved off ~10kb of minified JS.

@crisbeto crisbeto added the target: major This PR is targeted for the next major release label Apr 19, 2025
@crisbeto crisbeto requested a review from a team as a code owner April 19, 2025 09:42
@crisbeto crisbeto requested review from adolgachev and andrewseguin and removed request for a team April 19, 2025 09:42
@angular-robot angular-robot bot added area: performance Issues related to performance area: cdk/overlay labels Apr 19, 2025
Currently all the overlay APIs go through the `Overlay` service which means that even if an app only uses the fairly simple global positioning strategy, they'd still bring in all the code for the complex flexible positioning strategy.

These changes break up the APIs into constructor functions that can be tree shaken separately.

Note that I'll send follow-up PRs to roll this out in Material in order to see the full benefits.

From a simple test of a an `ng new` app that only uses `MatTooltip`, this shaved off ~10kb of minified JS.
@crisbeto crisbeto force-pushed the overlay-tree-shake branch from ea6230e to fb56acd Compare April 19, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: cdk/overlay area: performance Issues related to performance target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants