perf: stage collision and cleanup performance optimizations
Metadata
Current evaluation
Nine perf optimizations for stage-collision checks and lifecycle-state cleanup; +1061/-82 across 12 files. Pending review; most CI green, OSV-scanner and ppc64el fast tests failing.
Suggested action: needs review
Reason: PR is pending review with no unresolved comments and most CI checks passing; the OSV-scanner and ppc64el fast-test failures appear unrelated to the perf changes but need maintainer confirmation. The diff is substantial and touches collision/state internals, so maintainer review is warranted.
Evaluated by: mr-cal-bot
Impact:
60
Quick Win:
12
Complexity:
70
Confidence:
65
Actionability:
65
Issue body
## Summary
Nine focused performance optimizations to stage-collision checking and
lifecycle-state cleanup, extracted from project-specific performance work on a
real, large snap build. Each commit is independently benchmarked with
statistically significant results (Holm-corrected at family-wise alpha 0.05).
Two related candidate changes were evaluated but excluded because they did not
reach statistical significance on a targeted, isolated benchmark of the code
they touch (a 2-line "reuse empty path" tweak measured 0.54% *slower*,
p=0.796; an "avoid candidate directory stats" change measured 5.26% slower,
p=0.149).
## Commits
1. `perf(executor): cache stage collision candidate inventories` — 86.18%
faster collision checks (p=2.67e-7)
2. `perf(executor): validate changed stage candidates incrementally` —
45.13% faster on top of `#1` (p=1.75e-7)
3. `perf(executor): reuse resolved fileset paths` — 36.03% faster
(p=5.49e-6)
4. `perf(executor): cache resolved relative path parents` — 18.71% faster
on top of `#3` (p=0.000763)
5. `perf(executor): optimize fileset walk path construction` — 11.96%
faster (p=0.00291)
6. `perf(executor): reuse lifecycle states during cleanup` — 26.04%
faster stage cleanup (p=4.05e-6)
7. `perf(executor): copy only cleanup-mutated state sets` — 32.38%
faster on top of `#6` (p=2.23e-6)
8. `perf(state_manager): use safe C loader for state YAML` — 52.67%
faster (p=3.43e-7)
9. `perf(state_manager): cache parsed cleanup state YAML` — 81.10% faster,
merged by hand with `#8` so both optimizations are retained together
(p=1.26e-9)
Each commit message includes full benchmarking methodology and figures
(operation-level isolated benchmark plus the corresponding whole-build
median clean-build/rebuild improvement).
## Testing
- `pytest tests/unit` passes (only pre-existing, environment-specific
failures remain: missing JDK for `ant`/`java`/`maven` plugin tests, missing
`chisel` binary — unrelated to this change, present on `main` too).
- `ruff check` and `ruff format --check` pass.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| ~deepseek/deepseek-pro-latest |
Impact:
60
Quick Win:
12
Complexity:
70
Confidence:
65
Actionability:
65
|
needs review | Nine perf optimizations for stage-collision checks and lifecycle-state cleanup; +1061/-82 across 12 files. Pending review; most CI green, OSV-scanner and ppc64el fast tests failing. | |
| stealth/space-bunny-alpha |
Impact:
45
Quick Win:
5
Complexity:
78
Confidence:
58
Actionability:
55
|
needs review | Nine perf optimizations to stage-collision checking and lifecycle-state cleanup (candidate inventory caching, incremental validation, path/state reuse, CSafeLoader YAML, cached parsed state). +1057/-82, 12 files. Pending review; OSV-scanner failing, many CI jobs pending. | |
| qwen/qwen3.8-27b |
Impact:
55
Quick Win:
8
Complexity:
70
Confidence:
65
Actionability:
50
|
needs review | Nine perf optimizations to stage-collision checking and lifecycle-state cleanup (cache candidate inventories, incremental validation, reuse fileset paths, C YAML loader, cache parsed state). +1057/-82 across 12 files. 0 reviewers, 1 unresolved comment, OSV-scanner failing, many CI jobs pending. | |
| qwen/qwen3.8-27b |
Impact:
55
Quick Win:
7
Complexity:
70
Confidence:
65
Actionability:
45
|
needs review | Nine benchmarked performance optimizations to stage-collision checking and lifecycle-state cleanup (+1049/-81, 12 files). New PR, no reviewers yet; CI shows 3 failing checks (OSV-scanner, lint/files, test-common min-deps) and 1 unresolved review comment. | |
| qwen/qwen3.8-27b |
Impact:
55
Quick Win:
7
Complexity:
65
Confidence:
62
Actionability:
35
|
needs review | Nine performance optimizations to stage-collision checking and lifecycle-state cleanup in craft-parts, each with Holm-corrected benchmarks. New PR, 0 reviewers, 1 unresolved comment, 3 failing CI checks (OSV-scanner, lint/files, test-common min deps), 8 pending. |
Update history
| Date | Change |
|---|---|
| updated | |
| updated | |
| updated | |
| created |
Related issues
No related issues found above the similarity threshold.