Commit e91ca48
perf(CoilAdviser): early-terminate pattern enumeration once cap reached
CoilAdviser::get_advised_coil iterated patterns × repetitions ×
insulation-combinations exhaustively even when 1 result was requested
(every WebFrontend Wire-Advise-All call passes maximumNumberResults=1).
For multi-winding coils (Flyback, LLC, Push-Pull, IBB, Vienna,
Weinberg) the outer enumeration alone wastes work after a comfortable
candidate pool exists.
Cap the outer accumulation at 10× the caller's requested
maximumNumberResults (≥10 minimum) so the stable_sort still has
headroom to pick the top N, then break out of the repetition/pattern/
insulation loops.
Note: this is necessary but not sufficient. The dominant cost on
multi-winding cases is *inside* get_advised_coil_for_pattern (the
wire-configuration × winding × operating-point enumeration on lines
~145-260). Even with this cap a single pattern iteration can exceed
the WebFrontend Playwright @heavy timeout. Deeper restructuring of
the inner loops is filed as follow-up.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 5fc3f62 commit e91ca48
1 file changed
Lines changed: 25 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
245 | 245 | | |
246 | 246 | | |
247 | 247 | | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
248 | 258 | | |
| 259 | + | |
249 | 260 | | |
| 261 | + | |
250 | 262 | | |
| 263 | + | |
251 | 264 | | |
252 | 265 | | |
253 | 266 | | |
| |||
285 | 298 | | |
286 | 299 | | |
287 | 300 | | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
288 | 307 | | |
289 | 308 | | |
290 | 309 | | |
| |||
298 | 317 | | |
299 | 318 | | |
300 | 319 | | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
301 | 326 | | |
302 | 327 | | |
303 | 328 | | |
| |||
0 commit comments