Performance: What is Angular
MEDIUM IMPACT
Angular affects page load speed and rendering performance by how it manages DOM updates and component rendering.
import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: `<div *ngFor=\"let item of visibleItems\">{{item}}</div>` }) export class AppComponent { items = Array(1000).fill('Item'); visibleItems = this.items.slice(0, 20); // virtual scroll or pagination }
import { Component } from '@angular/core'; @Component({ selector: 'app-root', template: `<div *ngFor=\"let item of items\">{{item}}</div>` }) export class AppComponent { items = Array(1000).fill('Item'); }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Rendering large lists without optimization | 1000+ nodes | 1000+ reflows | High paint cost | [X] Bad |
| Rendering small visible subset with virtual scroll | 20 nodes | 20 reflows | Low paint cost | [OK] Good |