Performance: debounceTime for input throttling
MEDIUM IMPACT
This affects how often input events trigger updates, reducing unnecessary processing and improving interaction responsiveness.
this.searchInput.valueChanges.pipe(debounceTime(300)).subscribe(value => { this.search(value); });
this.searchInput.valueChanges.subscribe(value => { this.search(value); });
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| No debounce (handle every input) | Many rapid updates | Triggers reflow on each input | High paint frequency | [X] Bad |
| With debounceTime (300ms delay) | Fewer updates after pause | Single reflow per pause | Reduced paint frequency | [OK] Good |