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

perf: use pure annotations for tree shaking #1043

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

davidlj95
Copy link
Owner

@davidlj95 davidlj95 commented Nov 20, 2024

Issue or need

After seeing a pure annotation to RouterTitleKey symbol in Angular's router package, the use of pure annotations has given me several ideas:

Applying here the pure annotation when possible to improve tree shaking

Proposed changes

Use pure annotation to tree shake:

  • Symbols: ANGULAR_ROUTER_URL symbol if unused. It's the only symbol used around

Reviewed the API report and nothing else seems to bee applicable for optimizations using pure annotations.

Tested that the symbol is not in production bundle when removing its usage in example app + not providing withBaseUrl

Quick reminders

  • 🤝 I will follow Code of Conduct
  • No existing pull request already does almost same changes
  • 👁️ Contributing docs are something I've taken a look at
  • 📝 Commit messages convention has been followed
  • 💬 TSDoc comments have been added or updated indicating API visibility if API surface has changed.
  • 🧪 Tests have been added if needed. For instance, if adding new features or fixing a bug. Or removed if removing features.
  • ⚙️ API Report has been updated if API surface is altered.

Copy link
Owner Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@davidlj95 davidlj95 changed the title perf: tree shake ANGULAR_ROUTER_URL perf: use pure annotations for tree shaking Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (25ea17f) to head (37fb086).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main     #1043   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           89        89           
  Lines          389       389           
  Branches        49        49           
=========================================
  Hits           389       389           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Copy link

📦 Bundle size (Angular v18)

Git ref: 37fb086bc65fc57e7da4856120cadb3663b0775e

Module file Size Base size Difference
ngx-meta-core.mjs 3205 bytes (3.2KiB) Not available Not available
ngx-meta-json-ld.mjs 217 bytes (217B) Not available Not available
ngx-meta-open-graph.mjs 931 bytes (931B) Not available Not available
ngx-meta-routing.mjs 394 bytes (394B) Not available Not available
ngx-meta-standard.mjs 857 bytes (857B) Not available Not available
ngx-meta-twitter-card.mjs 487 bytes (487B) Not available Not available
Total 6091 bytes (6.0KiB) Not available Not available

Base size data is not available yet. Try again when the CI/CD has finished running on main branch

Copy link

📦 Bundle size (Angular v15)

Git ref: 37fb086bc65fc57e7da4856120cadb3663b0775e

Module file Size Base size Difference
ngx-meta-core.mjs 3384 bytes (3.4KiB) Not available Not available
ngx-meta-json-ld.mjs 206 bytes (206B) Not available Not available
ngx-meta-open-graph.mjs 870 bytes (870B) Not available Not available
ngx-meta-routing.mjs 373 bytes (373B) Not available Not available
ngx-meta-standard.mjs 808 bytes (808B) Not available Not available
ngx-meta-twitter-card.mjs 448 bytes (448B) Not available Not available
Total 6089 bytes (6.0KiB) Not available Not available

Base size data is not available yet. Try again when the CI/CD has finished running on main branch

Copy link

📦 Bundle size (Angular v17)

Git ref: 37fb086bc65fc57e7da4856120cadb3663b0775e

Module file Size Base size Difference
ngx-meta-core.mjs 3205 bytes (3.2KiB) Not available Not available
ngx-meta-json-ld.mjs 217 bytes (217B) Not available Not available
ngx-meta-open-graph.mjs 931 bytes (931B) Not available Not available
ngx-meta-routing.mjs 394 bytes (394B) Not available Not available
ngx-meta-standard.mjs 857 bytes (857B) Not available Not available
ngx-meta-twitter-card.mjs 487 bytes (487B) Not available Not available
Total 6091 bytes (6.0KiB) Not available Not available

Base size data is not available yet. Try again when the CI/CD has finished running on main branch

Copy link

📦 Bundle size (Angular v16)

Git ref: 37fb086bc65fc57e7da4856120cadb3663b0775e

Module file Size Base size Difference
ngx-meta-core.mjs 3467 bytes (3.4KiB) Not available Not available
ngx-meta-json-ld.mjs 201 bytes (201B) Not available Not available
ngx-meta-open-graph.mjs 870 bytes (870B) Not available Not available
ngx-meta-routing.mjs 379 bytes (379B) Not available Not available
ngx-meta-standard.mjs 808 bytes (808B) Not available Not available
ngx-meta-twitter-card.mjs 448 bytes (448B) Not available Not available
Total 6173 bytes (6.1KiB) Not available Not available

Base size data is not available yet. Try again when the CI/CD has finished running on main branch

@davidlj95 davidlj95 marked this pull request as ready for review November 20, 2024 16:28
@davidlj95 davidlj95 merged commit 18e4eb4 into main Nov 20, 2024
35 checks passed
@davidlj95 davidlj95 deleted the stacked/angular-router-url-pure branch November 20, 2024 16:28
Copy link

🎉 This PR is included in version 1.0.0-beta.34 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant