Title: Convert [ngClass]="{x: ...}" to [class.x]="..." during prod build · Issue #45734 · angular/angular · GitHub
Open Graph Title: Convert [ngClass]="{x: ...}" to [class.x]="..." during prod build · Issue #45734 · angular/angular
X Title: Convert [ngClass]="{x: ...}" to [class.x]="..." during prod build · Issue #45734 · angular/angular
Description: Which @angular/* package(s) are relevant/related to the feature request? common, compiler Description I noticed that [ngClass]="..." syntax is heavier and slower than [class.x]="..." syntax. ...if I made tests in the right way =) I did s...
Open Graph Description: Which @angular/* package(s) are relevant/related to the feature request? common, compiler Description I noticed that [ngClass]="..." syntax is heavier and slower than [class.x]="..." syntax. ...if ...
X Description: Which @angular/* package(s) are relevant/related to the feature request? common, compiler Description I noticed that [ngClass]="..." syntax is heavier and slower than [class.x]="...&...
Opengraph URL: https://github.com/angular/angular/issues/45734
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Convert [ngClass]=\"{x: ...}\" to [class.x]=\"...\" during prod build","articleBody":"### Which @angular/* package(s) are relevant/related to the feature request?\r\n\r\ncommon, compiler\r\n\r\n### Description\r\n\r\nI noticed that [ngClass]=\"...\" syntax is heavier and slower than [class.x]=\"...\" syntax.\r\n...if I made tests in the right way =)\r\n\r\nI did some tests here: https://github.com/IvanBisultanov/angular_bundle_size\r\n\r\ncase1 - ngClass:1_className\r\ncase2 - class.:1_className\r\ncase3 - ngClass:5_classNames\r\ncase4 - class.:5_classNames\r\ncase5 - ngClass:10_classNames_x_2000\r\ncase6 - class.:10_classNames_x_2000\r\n\r\nThese are the results:\r\nProd bundle size | size 1/3/5 | size 2/4/6 | Diff \r\n---|------------|------------|--- \r\ncase1 vs case2 | 158110 | 158051 | -59\r\ncase3 vs case4 | 158483 | 158117 | -366\r\ncase5 vs case6 | 164574 | 164357 | -217\r\n \r\n`npm run start-prod` scripting time performance tab\r\n\r\nAttempt | 1 | 2 | 3 | 4 | 5 | Average\r\n--- |-----|-----|-----|-----|-----|---------\r\ncase5, ms | 242 | 237 | 231 | 236 | 234 | 236\r\ncase6, ms | 185 | 186 | 185 | 176 | 180 | 183\r\nDiff| | | | | |-53\r\n\r\n### Proposed solution\r\n\r\nIs it possible during production build to convert [ngClass] to [class.] and then bundle the code?\r\nAs result, we will have a smaller bundle and seems a bit faster application.\r\n\r\n### Alternatives considered\r\n\r\nNone.","author":{"url":"https://github.com/IvanBisultanov","@type":"Person","name":"IvanBisultanov"},"datePublished":"2022-04-23T14:25:02Z","url":"https://github.com/angular/angular/issues/45734"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:20a3af45-29ef-14c7-5e9e-61dab6647522 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A5B8:65478:160454F:1D3A0A4:6B013400 |
| html-safe-nonce | 76e1bd2889e24e787a812b1bbf25b4013973e763740aca048fd5750304828f0f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNUI4OjY1NDc4OjE2MDQ1NEY6MUQzQTBBNDo2QjAxMzQwMCIsInZpc2l0b3JfaWQiOiIxMDMzNTE4NzQzMDgwOTI5MjgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 32b47d3f5e34bad9245b0edcf3e5cae9f463a3c3e2b64d7a42529050e7184e15 |
| hovercard-subject-tag | issue:1213328422 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular/45734/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c75bfff312d124bae1dc5d4ed7d26ab3f116d6b7f6eb6b21c1dc1e3f7eafdd0e/angular/angular/issues/45734 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c75bfff312d124bae1dc5d4ed7d26ab3f116d6b7f6eb6b21c1dc1e3f7eafdd0e/angular/angular/issues/45734 |
| og:image:alt | Which @angular/* package(s) are relevant/related to the feature request? common, compiler Description I noticed that [ngClass]="..." syntax is heavier and slower than [class.x]="..." syntax. ...if ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | IvanBisultanov |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width