Skip to content

perf(dedup): remove O(nodes x components) scan from remap construction - #2328

Closed
stupidprogrammer4 wants to merge 1 commit into
Graphify-Labs:v8from
stupidprogrammer4:v8
Closed

perf(dedup): remove O(nodes x components) scan from remap construction#2328
stupidprogrammer4 wants to merge 1 commit into
Graphify-Labs:v8from
stupidprogrammer4:v8

perf(dedup): remove O(nodes x components) scan from remap construction

9948a54
Select commit
Loading
Failed to load commit list.
Graphify Labs / Graphify succeeded Jul 30, 2026 in 0s

Graphify — looks good

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).

Details

Graphify reviewed this change.

Looks safe to merge — no coupling regressions and no blocking issues, checked against the code graph (not a self-assessment).


Graphify review — findings

This PR refactors the remap-construction loop in deduplicate_entities (in graphify/dedup.py). Instead of re-scanning the full unique_nodes list for each connected component, it builds a single nodes_by_id lookup mapping each id to its position and node, then constructs each group_nodes by looking up members and sorting them by original position. The stated intent is a performance optimization for large corpora, while preserving unique_nodes ordering so that _pick_winner's tie-breaking behavior remains unchanged. The many graphify_dedup_* symbols listed appear to be the surrounding module contents; the actual code change is localized to this loop.

No blocking issues surfaced. 3 lower-confidence candidates did not survive cross-model review.

Analysis details — impact, health, verification

Impact & health

Graphify review

Impact — 258 functions depend on the 43 functions this change touches.

Health — grade A; 7 existing hotspot(s) in the area this change touches (pre-existing, not introduced here):

  • deduplicate_entities() — 49 callers, 21 callees (high)
  • dispatch_command() — 2 callers, 110 callees (high)
  • main() — 81 callers, 2 callees (high)
  • build_merge() — 23 callers, 7 callees (high)
  • build() — 19 callers, 3 callees (high)
  • _run() — 12 callers, 1 callees (medium)
  • _llm_tiebreak() — 1 callers, 11 callees (medium)

Verification — 258 functions in the blast radius were not formally verified this run (proofs are advisory here).

Gate & verification

graphify gate

PASS — objectively clean (no health regressions, tests not run — proofs not run this pass (advisory)). Grounded, not self-assessed.

Advisory (not blocking):

  • verification_scope: 116 function(s) in the blast radius were not formally verified this run