Speed up sourcemap lookups by checking existence of .map files#1780
Merged
connor4312 merged 7 commits intomicrosoft:mainfrom Aug 11, 2023
Merged
Speed up sourcemap lookups by checking existence of .map files#1780connor4312 merged 7 commits intomicrosoft:mainfrom
connor4312 merged 7 commits intomicrosoft:mainfrom
Conversation
connor4312
reviewed
Aug 7, 2023
| fileContents = await readfile(compiledPath); | ||
| let sourceMapUrl; | ||
| const possibleSourceMapURL = `${compiledPath}.map`; | ||
| if (await fsUtils.exists(possibleSourceMapURL)) { |
Member
There was a problem hiding this comment.
Rather than making a separate exists call here, you can pass the siblings elements of the directory to the fileProcessor function.
It's called by readSomething which is called for the root entry (no siblings) and in handleDirectoryEntry. In the latter case, it's called reading either from the cache tree (where Object.keys(cache.children) are siblings) or from the filesystem (where files are siblings)
Contributor
Author
There was a problem hiding this comment.
Updated. I'm not fully sure thou if you meant the same changes
connor4312
reviewed
Aug 8, 2023
alexr00
approved these changes
Aug 10, 2023
connor4312
approved these changes
Aug 11, 2023
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.
Problem
Debugging experience is slow in large monorepos, since all the files are read to check location of sourcemap file
PR fix
Check if .map file exists for compiled file we don't need to read file to find location of sourcemap location.
Possible issue
If there is a js file and it has .map file which is not a sourcemap file with same js file name, it can lead to issue.
This however should be rare edge case.