Repository navigation
Conversation
Batch marked-path resolution and cache display crumbs across unchanged frames. Bound removal nesting, index queue mutations, absorb descendants in one pass, and index Review status from each fresh plan. Include deterministic state/window work budgets, path and invalidation regression coverage, and measured red/green evidence. Removal authorization remains freshly revalidated before deletion.
huntharo
force-pushed
the
fix/main-mark-performance-20261014
branch
from
October 15, 2026 02:28
fbcd86f to
11ff1d9
Compare
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Superseded by tobi/disktree#105. The 12 development commits have been consolidated into
11ff1d98ab5daf357c5a0319ad4943a69e6bb164. This fork PR is retained as the historical development/review record.Thanks for disktree. I’m looking at programmatic/MCP cleanup workflows that can queue many unrelated paths for review. Main repeatedly scans those queues during marking and rendering; this PR bounds that work in one main-based change, consolidated into one commit covering path resolution, queue mutation, and Review status lookup.
Development and review took place in huntharo/disktree#9, which this upstream PR supersedes. All fixes and evidence are consolidated into one commit based directly on
main.A mark is one file or folder queued for removal. A folder containing a million files is still one mark. A queue of 1,024 independently marked paths is a large-queue stress case, not an established frequent manual workload. This PR improves the existing state/render paths; it does not add an MCP endpoint.
The cost is paid at different points:
Marks::refreshresolves the marked paths again. This refresh is not part of every hover or marking action.The previously reported 6.60 seconds measured four forced Explore draws/eight prepares, with a large queue already present. It was not one scan, one click, or the time to select 1,024 items. The input measurements below have a different, explicit denominator.
These are medians of three input repetitions in the real GPUI window harness on a fixed, real temporary tree: 1,025 sibling folders with one file each, a 1,400×900 window, and both panels visible. Space adds one more folder; hover/Review then run with that extra mark. Each timed input causes two or three renders in the harness and asserts zero mark refreshes/rescans. Main was replayed immediately before the combined implementation on macOS arm64/Rust 1.97.1 with the repository test profile. These are observed harness timings, not release-app per-click guarantees. Small queues were already fast; no substantial small-queue speedup is claimed.
The implementation changes six paths:
These bounds have additional path/name-length costs. Exact mark membership changes from expected hash O(1) to ordered O(log M); no fields are added to scan nodes. Mark order, existing path/component/case comparisons, exact non-UTF-8 paths, first blocked reason, absorbed-count notices and cached-crumb invalidation are tested. Single-item unmarking still compacts the ordered vector; multiple separately invoked parent edits can each require a compaction.
The expansion has its own red/green evidence. The “before” below is pre-expansion #9, with the original path-resolution/removal-plan fixes already included, not a fresh comparison against main:
The blocked fixture queues paths outside the scanned root. The covered fixture supplies a raw overlapping parent/children queue, which normal manual marking would absorb. These fixtures plan and render only; they attempt no deletion.
Mutation units count visits/index requests, not internal B-tree comparisons; the logarithmic factor is included in the bounds above. Review units include index construction and row queries. The regular budgets grow 128→1,024 entries, require at most 16× work and enforce absolute caps. File insertion, folder insertion, parent absorption and both Review status cases fail before their fixes and pass afterward. Review also passes at 8,192 items, with 10,592 status units per render and the 1,200-row cap preserved. The tests drive actual state transitions or window rendering, so a faster helper alone cannot satisfy them.
Review’s total wall improvement is smaller than its status-lookup reduction: the screen still lays out up to 1,200 rows and evaluates guards/volume attribution for the queue. Plan computation remains per render, and the removal worker still rereads mounts/checks links immediately before deletion. Only display data is reused across renders; no removal authorization is cached. Future MCP bulk control should submit additions within one UI transaction to avoid a redraw per tool call.
Combined evidence, historical snapshots, raw samples, complexity details and reproduction commands. Earlier measurements are retained and labelled as historical stages. The deeper breadcrumb, mount-topology and unusual classification cases from the broader audit remain separate follow-ups. The PR has no dependency on the APFS feature branch.
Validation:
cargo xtask lintpasses;cargo xtask testpasses 88 app + 150 core + 3 xtask tests (241 total). Two pre-existing ignored core tests and the opt-in timing test remain ignored by the normal suite; the timing test passes explicitly. All original and expanded budgets pass. Local validation is macOS arm64; other platforms remain for existing CI. Scans and destructive tests use private temporary fixtures.Historical red/green snapshots and reproduction
The IDs below record pre-consolidation development snapshots from the fork PR; they are not separate commits in this upstream branch. The linked evidence explains how to fetch each historical snapshot.
5a3c92e: original main algorithms plus probes; original refresh/window/removal-nesting budgets fail.1206fda: original path-resolution/removal-plan fixes.57d4efd: new queue/parent/Review budgets fail on pre-expansion Fix quadratic marking, path resolution, and removal review #9.e88b9e1: indexed marking and one-pass absorption.b71718f: indexed Review status from each freshly computed plan.1c36fae: folder insertion budget, also demonstrated failing against the old algorithm.d886865: preserve the original ancestor choice for raw path spellings with redundant separators.To reproduce the expanded red stage in a disposable checkout:
git fetch https://github.com/huntharo/disktree.git \ 57d4efde372e7f08e0a2b91a906ff3b870abaddc git switch --detach FETCH_HEAD cargo test -p disktree-app budget -- --nocapture --test-threads=1At the final head: