Commit e57de6f
authored
perf: large-repo indexing pass (type refs, health, dynamic hints, dead code) + update-path fixes (#450)
* perf(ingestion): index defined symbol names once in type-ref resolution
Type-ref resolution scanned graph.successors() of every candidate file
for every type reference to find a type's defining file, costing
O(refs x candidates x symbols_per_file) on package-fan-out languages.
On hugo (896 Go files) this was 8s of an 11s graph build.
Build one node-to-defined-symbol-names map per resolve pass and answer
lookups by set membership; hoist per-file candidate sorting out of the
per-ref loop. Only file-to-file type_use edges are added while the
strategies run, so the upfront index matches live scanning. The full
graph snapshot on hugo is bit-identical under a fixed hash seed; graph
build drops from 10.8s to 2.7s.
* perf(health): precompute test-pair basenames once per analyze pass
_has_paired_test_file scanned every analyzed path for every evaluated
file, doing O(files x paths x candidates) string suffix checks. On hugo
(2,014 files) that was 16.5s of the health phase under cProfile.
A path matches endswith(/ + candidate) or equals the candidate
exactly when its /-basename equals the candidate, so one basename set
built per analyze pass answers every lookup by set membership. Health
full analysis on hugo drops from 18.3s to 12.9s isolated (warm
duplication cache). A regression test pins the new lookup to a verbatim
copy of the old scan over a corpus of tricky paths.
* fix(cli): record the workspace distill verdict before init fingerprints config
repowise update backfills a workspace member's distill.commands.enabled
verdict into .repowise/config.yaml at the start of every run. Init left
the verdict unwritten, so the first update of every workspace member saw
a config-fingerprint mismatch and silently replaced the incremental path
with a full health re-score of every file (47s instead of the partial
update on an ~900-file Go repo). Init now runs the same backfill before
computing the fingerprint, making the update-time backfill a no-op.
* perf(ingestion): share one walk snapshot across dynamic-hint extractors
The 18 dynamic-hint extractors issued ~40 iter_glob queries per run and
each walked the tree from disk (the C++ extractor alone walks once per
extension). WalkSnapshot in fs_walk replays a single pruned walk for all
of them, preserving iter_glob semantics and yield order, serving
subtree-rooted queries from the snapshot, and falling back to a live
walk outside the tree. extract_all on hugo drops from 2.9s to 0.8s with
a bit-identical edge list.
* fix(pipeline): converge the update-built graph with the init-built graph
The incremental rebuild skipped two edge passes the init pipeline runs:
dynamic hints never executed on update, and co_changes edges were
re-added only for the changed files on a graph rebuilt from scratch, so
unchanged files lost their co-change edges. Metrics persisted by an
update disagreed with init for identical code, and the first post-init
update could never hit the centrality cache, recomputing betweenness
(~11s on hugo) on every fresh-init-then-update sequence.
build_repo_graph now runs the dynamic-hint registry like init does, and
index_changed_files exposes the full per-file partner map its repo-wide
co-change walk already computes so rebuild_graph_and_git re-adds
co_changes edges for every file. A convergence test asserts node and
edge set equality plus centrality-cache signature equality between
init-shaped and update-shaped builds.
* refactor(git): derive blame ownership from the single porcelain pass
Files below the function-blame commit floor took a second blame pass
through gitpython repo.blame just for ownership, while denser files
already derived ownership from the porcelain BlameIndex parse. One
git blame --line-porcelain invocation now serves both signals for
every file; the commit floor only gates whether the BlameIndex is
retained for the function biomarkers, exactly as before.
Wall time is neutral (blame cost is the subprocess, measured on a
~900-file repo), but ownership is bit-identical across that corpus,
the GIL-holding gitpython object parse no longer competes with
concurrent ingestion, and the duplicate code path is gone.
* perf(analysis): memoize the dead-code never-flag regex match
The never-flag alternation compiles ~540 globs into one pattern, so a
single match costs tens of microseconds, and both node-scanning
detector passes ask about the same ~15k node ids. A module-level
lru_cache on the match (a pure function of the path; the pattern set
is a module constant) cuts the full dead-code pass from 3.1s to 1.8s
on hugo, 0.4s for repeat analyses, with identical findings.1 parent a9af432 commit e57de6f
22 files changed
Lines changed: 1031 additions & 122 deletions
File tree
- packages
- cli/src/repowise/cli/commands/init_cmd
- core/src/repowise/core
- analysis
- dead_code
- health
- ingestion
- dynamic_hints
- git_indexer
- pipeline
- tests/unit
- cli
- dead_code
- health
- ingestion
- pipeline
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
795 | 795 | | |
796 | 796 | | |
797 | 797 | | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
798 | 807 | | |
799 | 808 | | |
800 | 809 | | |
| |||
Lines changed: 14 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
339 | 339 | | |
340 | 340 | | |
341 | 341 | | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
342 | 355 | | |
343 | 356 | | |
344 | 357 | | |
| |||
1186 | 1199 | | |
1187 | 1200 | | |
1188 | 1201 | | |
1189 | | - | |
| 1202 | + | |
1190 | 1203 | | |
1191 | 1204 | | |
1192 | 1205 | | |
| |||
Lines changed: 22 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
223 | 235 | | |
224 | 236 | | |
225 | 237 | | |
226 | | - | |
| 238 | + | |
| 239 | + | |
227 | 240 | | |
228 | 241 | | |
229 | 242 | | |
| |||
241 | 254 | | |
242 | 255 | | |
243 | 256 | | |
244 | | - | |
245 | | - | |
246 | | - | |
| 257 | + | |
247 | 258 | | |
248 | 259 | | |
249 | 260 | | |
| |||
301 | 312 | | |
302 | 313 | | |
303 | 314 | | |
304 | | - | |
| 315 | + | |
305 | 316 | | |
306 | 317 | | |
307 | 318 | | |
| |||
364 | 375 | | |
365 | 376 | | |
366 | 377 | | |
367 | | - | |
| 378 | + | |
368 | 379 | | |
369 | 380 | | |
370 | 381 | | |
| |||
422 | 433 | | |
423 | 434 | | |
424 | 435 | | |
425 | | - | |
| 436 | + | |
426 | 437 | | |
427 | 438 | | |
428 | 439 | | |
| |||
504 | 515 | | |
505 | 516 | | |
506 | 517 | | |
507 | | - | |
| 518 | + | |
508 | 519 | | |
509 | 520 | | |
510 | 521 | | |
| |||
581 | 592 | | |
582 | 593 | | |
583 | 594 | | |
584 | | - | |
| 595 | + | |
585 | 596 | | |
586 | 597 | | |
587 | 598 | | |
| |||
627 | 638 | | |
628 | 639 | | |
629 | 640 | | |
630 | | - | |
| 641 | + | |
631 | 642 | | |
632 | 643 | | |
633 | 644 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
199 | 276 | | |
200 | 277 | | |
201 | 278 | | |
| |||
Lines changed: 12 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
23 | 29 | | |
24 | 30 | | |
25 | 31 | | |
26 | | - | |
27 | | - | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | 36 | | |
32 | | - | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
33 | 40 | | |
| 41 | + | |
| 42 | + | |
34 | 43 | | |
Lines changed: 32 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
103 | 124 | | |
104 | 125 | | |
105 | 126 | | |
| |||
Lines changed: 7 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
| 98 | + | |
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
| |||
172 | 172 | | |
173 | 173 | | |
174 | 174 | | |
175 | | - | |
176 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
177 | 180 | | |
178 | | - | |
| 181 | + | |
179 | 182 | | |
180 | 183 | | |
181 | 184 | | |
| |||
Lines changed: 16 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
34 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
35 | 39 | | |
36 | 40 | | |
37 | 41 | | |
| |||
384 | 388 | | |
385 | 389 | | |
386 | 390 | | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
387 | 399 | | |
388 | 400 | | |
389 | 401 | | |
| |||
392 | 404 | | |
393 | 405 | | |
394 | 406 | | |
395 | | - | |
396 | 407 | | |
397 | 408 | | |
398 | | - | |
| 409 | + | |
| 410 | + | |
399 | 411 | | |
400 | 412 | | |
401 | 413 | | |
402 | 414 | | |
403 | 415 | | |
404 | | - | |
405 | | - | |
406 | | - | |
407 | | - | |
408 | | - | |
409 | | - | |
410 | | - | |
411 | | - | |
412 | | - | |
413 | | - | |
414 | 416 | | |
415 | 417 | | |
416 | 418 | | |
| |||
0 commit comments