Skip to content

perf: linearize manifest component expansion#180

Open
johnson-ricon wants to merge 1 commit into
junior/changed-note-ref-difffrom
johnson/fix-ref-diff-component-scaling
Open

perf: linearize manifest component expansion#180
johnson-ricon wants to merge 1 commit into
junior/changed-note-ref-difffrom
johnson/fix-ref-diff-component-scaling

Conversation

@johnson-ricon

Copy link
Copy Markdown
Contributor

Finding

PR #177's fixed-point component expansion rescans every manifest edge until no ID or path is added. Edge order can make a long alias chain advance only one hop per pass, so this stage is quadratic in manifest size. A 3,001-ID reverse-ordered synthetic component took 7.258 seconds at exact reviewed head 3de63a2, despite the PR's scaling goal.

This fix builds the same bipartite ID/path components with union-find and then selects all IDs whose component contains a seed. The same 3,001-ID case returns all 3,001 IDs in 0.096 seconds, with no new subprocesses or blob materialization.

Validation

  • before/after synthetic 3,001-ID component: 7.258s → 0.096s
  • mise run test — 404 BATS tests and 9 Python tests passed
  • mise run test diff — 14/14 passed
  • all eight Codebase lints passed
  • mise run doctor passed; optional local pre-commit hook remains uninstalled
  • bash -n lib/diff.sh .mise/tasks/diff
  • readme build --check
  • git diff --check

Fixes one adversarial review finding on #176.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant