Commit ef27fe2
committed
perf(@angular/build): reduce watcher debounce latency for faster incremental rebuilds
Previously, the esbuild file watcher utilized a static 250 ms trailing debounce timer (scheduleFlush) after each filesystem change event.
In incremental watch mode rebuilds where the actual compile and bundle step takes 150 ms to 220 ms, this 250 ms debounce delay accounted for over 50% of the developer-perceived turnaround time.
To accelerate the developer edit-refresh feedback loop:
- Replace the fixed 250 ms debounce in WatcherQueue with an adaptive debounce mechanism.
- Use a 25 ms debounce delay to quickly coalesce rapid multi-file atomic saves and editor formatters without forcing developers to wait a quarter of a second.
- Introduce a 100 ms maximum wait ceiling (maxWaitMs) to ensure rebuilds are not postponed indefinitely during continuous file events.
In benchmarks on ng build --watch, single-file save turnaround dropped from 470–550 ms to ~105 ms (~75% reduction in latency), saving approximately 360 ms per save.1 parent 6b20983 commit ef27fe2
1 file changed
Lines changed: 18 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
144 | 150 | | |
145 | 151 | | |
146 | 152 | | |
| |||
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
170 | 179 | | |
171 | 180 | | |
172 | 181 | | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
173 | 187 | | |
174 | 188 | | |
| 189 | + | |
175 | 190 | | |
176 | | - | |
| 191 | + | |
177 | 192 | | |
178 | 193 | | |
179 | 194 | | |
| 195 | + | |
180 | 196 | | |
181 | 197 | | |
182 | 198 | | |
| |||
224 | 240 | | |
225 | 241 | | |
226 | 242 | | |
| 243 | + | |
227 | 244 | | |
228 | 245 | | |
229 | 246 | | |
| |||
0 commit comments