Performance: Signal vs observable comparison
MEDIUM IMPACT
This concept affects how Angular apps handle data updates and UI rendering speed.
const value = signal(initialValue); // Signal usage value.set(newValue); // Updates UI reactively with minimal overhead
this.data$.subscribe(value => { this.value = value; }); // Observable subscription in component
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Observable subscription with frequent updates | Multiple updates to DOM nodes | Multiple reflows per update | Higher paint cost due to broad changes | [X] Bad |
| Signal with direct reactive updates | Minimal DOM node updates | Single reflow per update | Lower paint cost with targeted changes | [OK] Good |