Skip to content

perf(clean): reduce per-item preview shell overhead - #2247

Merged
tw93 merged 1 commit into
tw93:mainfrom
Yuxin-Qiao:codex/trim-clean-preview-shell-overhead
Dec 5, 2026
Merged

tw93 merged 1 commit into
tw93:mainfrom
Yuxin-Qiao:codex/trim-clean-preview-shell-overhead

Conversation

@Yuxin-Qiao

Copy link
Copy Markdown
Contributor

Summary

  • Avoid per-item command substitutions when clean records path identity and checks live cache scope.
  • Use Bash's function-existence check for dry-run eligibility without generating the function body.

Safety Review

  • This changes internal cleanup and preview helpers. Preview still invokes the same protection and availability checks. Cache-owner classification and the live-cache guard use the same inputs and status codes.
  • File deduplication still uses device and inode when available, with the existing path fallback. The stat order for symlinks and the existing normalization of unusual paths are preserved.

Tests

  • Added Bats checks for returned path identities and cache scopes.
  • Local full suite passed on the measured baseline and when this patch was combined with independent history changes on a later main revision. Format and targeted Bats tests were rerun on the PR base.
  • Manual read-only A/B on a single arm64 Mac with warm caches, fixed at db8371d0. Three runs per version of mo clean --dry-run gave medians of 59.651 s on main and 54.856 s with the patch. Across the nine-run experiment, candidate paths and order matched. Each run reported 1,731 items and 13.54 GB. One live cache size estimate changed by 0.1 MB in the last run.
  • A separate fixture exercised preview and real cleanup of 200 generated cache files. The removed files and operation-log records matched.

@Yuxin-Qiao
Yuxin-Qiao requested a review from tw93 as a code owner December 5, 2026 03:27
@tw93

tw93 commented Dec 5, 2026

Copy link
Copy Markdown
Owner

@Yuxin-Qiao Thanks for replacing the per-path sed subprocesses in mole_normalize_path with pure Bash string operations! Merged into main.

@tw93
tw93 merged commit e38ba12 into tw93:main Dec 5, 2026
12 checks passed
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.

2 participants