Skip to content

Avoid re-reading the staged file when resolving its sourcemap path during breakpoint injection - #392

Open
TwitchBronBron wants to merge 1 commit into
masterfrom
perf/avoid-double-read-breakpoint-files
Open

Avoid re-reading the staged file when resolving its sourcemap path during breakpoint injection#392
TwitchBronBron wants to merge 1 commit into
masterfrom
perf/avoid-double-read-breakpoint-files

Conversation

@TwitchBronBron

Copy link
Copy Markdown
Member

writeBreakpointsToFile reads the staged file into fileContents, then — for source-mapped files — calls getSourceMapPath, which read the exact same file again from disk just to extract its sourceMappingURL comment.

  • getSourceMapPath now accepts optional pre-loaded fileContents and uses them instead of reading the file when provided (still reads the file itself when omitted; result is still cached).
  • writeBreakpointsToFile passes the fileContents it already loaded, eliminating the second read.

Telnet sessions with source maps only; small win, but it's a redundant read of a file already in memory.

…ring breakpoint injection

writeBreakpointsToFile reads the staged file into `fileContents`, then (for source-mapped
files) called getSourceMapPath, which read the exact same file again from disk just to
extract its sourceMappingURL comment.

- getSourceMapPath now accepts optional pre-loaded fileContents and uses them instead of
  reading the file when provided (still reads itself when omitted; still cached).
- writeBreakpointsToFile passes the fileContents it already has, eliminating the second read.

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