Performance: Why signals are introduced
HIGH IMPACT
Signals improve how Angular tracks changes, reducing unnecessary work during rendering and speeding up user interactions.
import { signal } from '@angular/core'; class MyComponent { data = signal([]); updateData(newData) { this.data.set(newData); // Only updates dependents of this signal } }
class MyComponent { data = []; updateData(newData) { this.data = newData; // Angular runs full change detection on all bindings } }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Full Angular Change Detection | Many nodes checked | Multiple reflows if many bindings update | High paint cost due to large updates | [X] Bad |
| Using Angular Signals | Only dependent nodes updated | Single or minimal reflows | Lower paint cost due to scoped updates | [OK] Good |