Sunday, April 2, 2023

Angular Performance Optimization Techniques

 


How to solve this problem?

Optimization Techniques

1: OnPush change detection strategy

@Component({
selector: ‘child-component',
changeDetection: ChangeDetectionStrategy.OnPush,
template: `...`
})

2: Detach Change Detection/NgZone

class TestComponent {
constructor(private changeDetectorRef: ChangeDetectorRef) {
changeDetectorRef.detach()
}
clickHandler() {
chnageDetectorRef.detectChnages()
}
}

3: Using Pure Pipes

4: AOT Compilation

5: Lazy Loading

export const routes = [
…homeRoutes,
{
path: “users”,
loadChildren: “./users/users.module#UserModule”,
}
];

6: Trackby

7: Web Workers

8: Preloading Modules

9: Resolve Guards

10: Unsubscribe from Observables

Technology’s generational moment with generative AI: A CIO and CTO guide

 Ref:  A CIO and CTO technology guide to generative AI | McKinsey 1. Determine the company’s posture for the adoption of generative AI As us...