Commit 96717a9
Fix remaining O(n*m) in cross-library resolution promotion path
Summary:
D106415307 fixed the O(n*m) unqualified-name scan in `resolve_cross_library_errors`'s error-*clearing* loop by adding the `globally_safe_funcs` index plus `is_call_verified_safe_indexed`. But the sibling call site — the function-*promotion* fixpoint (`promote_resolved_module_functions` -> `can_promote_missing_dep_function`) — was left calling the non-indexed `is_call_verified_safe` with `module_names` (every module). For each `UnsafeMissingDep` callee that does not resolve to a qualified module, that fallback scans all modules, so the promotion fixpoint stayed O(n*m).
This call site does not show up on the medium target but dominates on XL: on `confucius/server/ads_abtest:ads_abtest_server` (250,811 modules) `analyze-binary` was pinned single-threaded for 15+ minutes, with perf attributing ~95% of `resolve_cross_library_errors` to `is_call_verified_safe`.
Fix: route `can_promote_missing_dep_function` through the same `is_call_verified_safe_indexed` helper and `globally_safe_funcs` index that D106415307 already added. Because `module_names` covers every module and the index is kept in sync with promotions, the result is identical to the old unqualified scan but O(1) per callee instead of O(modules).
Result on XL (`ads_abtest_server`, 250,811 modules): `resolve_cross_library_errors` 15+ min -> 8.2s; `analyze-binary` total -> 14.3s.
Reviewed By: martindemello
Differential Revision: D107395893
fbshipit-source-id: 9761569f26f385c3ace7c68d1c4ea6ef679aa8761 parent 0c50ece commit 96717a9
1 file changed
Lines changed: 13 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
294 | 294 | | |
295 | 295 | | |
296 | 296 | | |
297 | | - | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
298 | 303 | | |
299 | 304 | | |
300 | 305 | | |
| |||
552 | 557 | | |
553 | 558 | | |
554 | 559 | | |
| 560 | + | |
555 | 561 | | |
556 | 562 | | |
557 | 563 | | |
558 | 564 | | |
559 | 565 | | |
560 | 566 | | |
561 | 567 | | |
562 | | - | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
563 | 574 | | |
564 | 575 | | |
565 | 576 | | |
| |||
0 commit comments