Skip to content

Cache the staging relative-path list so truncated-path lookups don't re-walk the tree - #393

Open
TwitchBronBron wants to merge 1 commit into
masterfrom
perf/cache-staging-relative-paths
Open

Cache the staging relative-path list so truncated-path lookups don't re-walk the tree#393
TwitchBronBron wants to merge 1 commit into
masterfrom
perf/cache-staging-relative-paths

Conversation

@TwitchBronBron

Copy link
Copy Markdown
Member

Resolving a truncated telnet debugger path goes through findPartialFileInDirectory, which walked the entire staging tree (glob('**/*')) on every call. During a session, each distinct truncated path triggered a fresh full walk.

  • findPartialFileInDirectory now takes an optional pre-computed relative-path list and only walks the tree itself when the list is omitted.
  • Project computes the staging relative-path list once per session (cached in getStagingRelativePaths), and buildStagingFileInfo passes it in.

The cache lives on Project (created fresh per debug session), so it can't go stale within a session, and a new session gets a fresh walk.

…re-walk the tree

Resolving a truncated telnet debugger path calls findPartialFileInDirectory, which walked
the entire staging tree (glob '**/*') on every call. Distinct truncated paths each triggered
a fresh full walk during a debug session.

- findPartialFileInDirectory now accepts an optional pre-computed relative-path list and only
  walks the tree itself when the list is omitted.
- Project computes the staging relative-path list once per session (cached in
  getStagingRelativePaths) and buildStagingFileInfo passes it into findPartialFileInDirectory.

The cache lives on Project (a new Project is created per debug session), so it can't go stale
within a session, and a fresh session gets a fresh walk.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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