Performance: FormControl basics
MEDIUM IMPACT
FormControl affects how user input updates the UI and triggers validation, impacting interaction responsiveness and rendering.
const control = new FormControl(''); control.valueChanges.pipe(debounceTime(300)).subscribe(() => { updateUI(); });
const control = new FormControl(''); control.valueChanges.subscribe(() => { // heavy logic or UI updates on every keystroke updateUI(); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Immediate valueChanges subscription | Many updates per keystroke | Multiple reflows | High paint cost | [X] Bad |
| Debounced valueChanges subscription | Fewer updates | Single or few reflows | Lower paint cost | [OK] Good |