Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Speed up sourcemap lookups by checking existence of .map files #1780

Merged
merged 7 commits into from
Aug 11, 2023

Conversation

sunilsurana
Copy link
Member

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.

fileContents = await readfile(compiledPath);
let sourceMapUrl;
const possibleSourceMapURL = `${compiledPath}.map`;
if (await fsUtils.exists(possibleSourceMapURL)) {
Copy link
Member

@connor4312 connor4312 Aug 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated. I'm not fully sure thou if you meant the same changes

@connor4312 connor4312 enabled auto-merge (squash) August 10, 2023 22:43
@connor4312 connor4312 enabled auto-merge (squash) August 10, 2023 22:43
@connor4312 connor4312 merged commit e82e8f7 into microsoft:main Aug 11, 2023
9 checks passed
@connor4312 connor4312 added this to the August 2023 milestone Aug 30, 2023
@gregvanl gregvanl changed the title Speed up sourcemap lookups by checking existance of .map files Speed up sourcemap lookups by checking existence of .map files Sep 6, 2023
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.

None yet

3 participants