You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Investigate why pure_getters had to be re-added #14316
I'm not an Angular user but I remember looking at this pure_getters issue at the time using the original pre-uglify rollup output from angular/angular#21880 (comment) (which doesn't exist now). Using:
Property reads are considered to be side effects with pure_getters disabled. Declaring property reads of IIFE objects at module scope will retain those IIFEs even if they are not otherwise used/referenced.
Here's a workaround to obtain similar minified size with pure_getters disabled. For illustrative purposes and convenience I'm just patching the generated unminified bundle directly. The IIFE property reads are moved into functions to make DCE more effective with pure call annotations:
Whoa @kzc that's amazing work, thank you so much for looking into this!
I was toying with the idea of adding some linter rules to prevent property access on toplevel modules and your analysis further cements that idea really.
Removing this from the 8.0 milestone. We're removing the toplevel property access in Angular (angular/angular#29329) and RxJs (ReactiveX/rxjs#4769), then checking the pure_getters impact on a few projects, then trying to remove it altogether post 8.
Activity
kzc commentedon May 1, 2019
Related issue: angular/angular#21880 (comment)
I'm not an Angular user but I remember looking at this pure_getters issue at the time using the original pre-uglify rollup output from angular/angular#21880 (comment) (which doesn't exist now). Using:
The minified size with pure_getters enabled:
The minified size with pure_getters disabled:
Property reads are considered to be side effects with pure_getters disabled. Declaring property reads of IIFE objects at module scope will retain those IIFEs even if they are not otherwise used/referenced.
Here's a workaround to obtain similar minified size with pure_getters disabled. For illustrative purposes and convenience I'm just patching the generated unminified bundle directly. The IIFE property reads are moved into functions to make DCE more effective with pure call annotations:
The size of the minified patched bundle with pure_getters disabled compares favorably to the original pure_getters version:
This might be the source code in question:
https://github.com/ReactiveX/rxjs/blob/8c5d8319105415a015e36a58c5c6a34a6dafbf2b/src/internal/observable/ConnectableObservable.ts#L58-L70
https://github.com/angular/angular/blob/7d6f4885b25f36ab5262d868b0a4d762dea27a62/packages/core/src/di/injector.ts#L120
filipesilva commentedon May 2, 2019
Whoa @kzc that's amazing work, thank you so much for looking into this!
I was toying with the idea of adding some linter rules to prevent property access on toplevel modules and your analysis further cements that idea really.
filipesilva commentedon May 2, 2019
Tried removing all property accesses in the Angular packages and it doesn't look like anything was being retained by accident: angular/angular#30239
filipesilva commentedon May 16, 2019
Removing this from the 8.0 milestone. We're removing the toplevel property access in Angular (angular/angular#29329) and RxJs (ReactiveX/rxjs#4769), then checking the pure_getters impact on a few projects, then trying to remove it altogether post 8.
fix(@angular-devkit/build-angular): remove pure_getters
angular-automatic-lock-bot commentedon Oct 25, 2019
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.
fix(@angular-devkit/build-angular): remove pure_getters