Skip to content

Walk the staging tree for .map files once per breakpoint pass, not once per breakpoint - #391

Open
TwitchBronBron wants to merge 1 commit into
masterfrom
perf/cache-staging-map-list
Open

Walk the staging tree for .map files once per breakpoint pass, not once per breakpoint#391
TwitchBronBron wants to merge 1 commit into
masterfrom
perf/cache-staging-map-list

Conversation

@TwitchBronBron

Copy link
Copy Markdown
Member

LocationManager.getStagingLocations runs a synchronous glob.sync('**/*.map') over the entire staging dir on every call, and getBreakpointWork calls it once per breakpoint. So validating N breakpoints means walking the whole staging tree N times — on the launch path. Same anti-pattern as the findEntryPoint hang.

  • Add LocationManager.getStagingMapPaths(stagingDir) and let getStagingLocations take a pre-computed map-path list, falling back to walking the tree when it's omitted.
  • getBreakpointWork now walks once up front and passes the list into every getStagingLocations call, so the tree is walked a single time regardless of breakpoint count.

Globbing fresh at the start of each validation pass (rather than caching across launches) keeps this correct when staging content changes between launches.

…ce per breakpoint

LocationManager.getStagingLocations ran a synchronous glob.sync('**/*.map') over the
entire staging dir on every call, and getBreakpointWork calls it once per breakpoint.
With N breakpoints that's N full-tree walks during breakpoint validation (on the launch
path). This is the same anti-pattern that caused the findEntryPoint hang.

- Add LocationManager.getStagingMapPaths(stagingDir) and let getStagingLocations accept a
  pre-computed list of map paths, falling back to walking the tree when omitted.
- getBreakpointWork now walks once up front and passes the list to every getStagingLocations
  call, so the staging tree is walked a single time regardless of breakpoint count.

Globbing fresh at the start of each validation pass (rather than caching across launches)
keeps correctness when staging content changes between launches.

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