-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Optimize EngineFileUtilities.GetFileList #6227
Optimize EngineFileUtilities.GetFileList #6227
Conversation
a1f33c2
to
1117dac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
{ | ||
return false; | ||
} | ||
|
||
// If the item's Include has both escaped wildcards and real wildcards, then it's |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You took out the color from the original! But that's ok 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mostly LGTM
string hexString = escapedString.Substring(indexOfPercent + 1, 2); | ||
char unescapedCharacter = (char)int.Parse(hexString, System.Globalization.NumberStyles.HexNumber, | ||
CultureInfo.InvariantCulture); | ||
char unescapedCharacter = (char)((digit1 << 4) + digit2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
src/Shared/EscapingUtilities.cs
Outdated
} | ||
index = escapedString.IndexOf('%', index + 1, escapedString.Length - index - 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why subtract 3 here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We want something that looks like %3f or whatever, and that takes three characters. This means no need for verifying that there are enough characters afterwards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, index + 1 means 1 less character to look at ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well, we also know that index is the index of a %, so using index instead would result in saying index = index;
ad infinitum.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tweaked the expression to be more readable and added comments.
1117dac
to
5f4f7c2
Compare
Fixes #6061
Context
EngineFileUtilities.GetFileList
has been identified as one of the performance bottlenecks when building .NET Core projects. Since this code is called as part of project evaluation, it directly impacts Visual Studio performance as well, especially solution load.Changes Made
Tweaked the code under
GetFileList
:Testing
Existing unit tests for correctness, ETL traces for performance.
This change together with #6151 is showing about 30% less time spent in this particular function when building a Hello World .NET Core project with the Framework version of MSBuild. It's an OK win for project evaluation perf but translates to less than 1 ms of total command line build time.
Notes
This PR is small but still recommended to be reviewed commit by commit.