perf: stop re-reading children in three model walks - #72
Merged
Merged
Conversation
…ection falls short Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What
Three plugin walks stop re-reading the same children. Every result stays as it is.
hide_unselected: the hide walk stops at selected items. Before, it descended through each selected subtree a second time, although nothing below a selected item can be hidden: the keep set already holds all of it. The keep set, its count, the hide list and its order, and the root summaries are unchanged.clash_bbox_pair_plan's refine step (refineDepth1 or 2): children are read once into a list. Before, the code readitem.Childrenthree times, one of them a fullCount(). This is the same pattern as perf(isolate): enumerate each item's children once #66.ModelItemidentity, in first-seen order. Before, k selected siblings under one parent re-read that parent's children k times, which is O(n^2). The resulting selection holds the same items.These three were found by a static audit (Codex, read-only, 569 s) of every child and descendant enumeration in
NavisHelper/. The curator confirmed each in the code. The audit's other findings (root-candidate details beyond the cap, the name-filter order in the clash matrix, the path-ambiguity replay, and a dormant panel) touch response contracts or are unreachable today, so they are left out.L3:
hide_unselected, two builds, interleaved, fresh process per armSetup:
6513.nwd, model root selected (41 016 items),apply=false, five calls per arm.main3548cf0main3548cf0HeavyWorkCollectionPolicycounts generation-0 collections, and this tool makes about 41 000 wrappers with little managed memory each, so the threshold is reached only every three or four calls. This PR does not fix that. It is recorded in the baseline as the next task.The refine step and Select Siblings were not measured live. The refine step needs a clash pair setup; Select Siblings is a panel command, out of MCP's reach. Both are output-equivalent by construction.
Provenance
7f06ee9: Codex (gpt-6-sol, high effort) wrote it from a 1.2 KB brief and a context file (147 s, main checkout untouched).993f96e: the curator recorded the measurement and the finding indocs/MCP_TOOL_BASELINE.md.Verification
ALL PASSon the head, rerun by the curator. It checks:item.Childrenonce, has noCount(), and iterates a list;CollectItemsToHidetakes the selected set and returns before descending into it;HashSet<ModelItem>;tools/listis unchanged, and the guards pass.🤖 Generated with Claude Code