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

GetAllGlobs optimizations #2652

Merged
merged 4 commits into from
Oct 23, 2017

Conversation

cdmihai
Copy link
Contributor

@cdmihai cdmihai commented Oct 18, 2017

GetAllGlobs has become part of the VS solution load critical path. This PR does a couple of optimizations:

  • makes MsBuildGlob computation lazy, so VS computes it on the first use, not when the solution opens
  • reduces allocations

Numbers from GetAllGlobs when simulating the Roslyn.sln solution load:

image
Not including the lazy glob change:
image
Including the lazy glob change:
image

Closes #2647

Eliminates enumerator allocations, and ImmutableList nodes.
Eliminates enumerator allocations, and ImmutableList nodes.
@cdmihai
Copy link
Contributor Author

cdmihai commented Oct 18, 2017

This has some positive memory effect to normal evaluations as well.

Evaluation: Time (ms)

Test Overall Significant δ Value
DotnetConsoleProject yes 90.5128 -> 89.9722 (-0.597%)
DotnetWebProject 🔴 yes 134.1791 -> 135.2581 (0.804%)
DotnetMvcProject 👌 no 159.2565 -> 159.4997 (0.153%)
Picasso yes 759.5962 -> 749.7776 (-1.293%)
SmallP2POldCsproj yes 131.4117 -> 128.2061 (-2.439%)
SmallP2PNewCsproj yes 240.465 -> 236.98 (-1.449%)
Generated_100_100_v150 yes 1582.2244 -> 1558.1152 (-1.524%)
LargeP2POldCsproj 🔴 yes 2192.5697 -> 2245.8899 (2.432%)
roslyn 👌 no 9367.4792 -> 9422.6194 (0.589%)

Evaluation: Memory (bytes)

Test Overall Significant δ Value
DotnetConsoleProject yes 4893316 -> 4860702 (-0.667%)
DotnetWebProject yes 6566869 -> 6533440 (-0.509%)
DotnetMvcProject yes 7409405 -> 7378798 (-0.413%)
Picasso yes 34226829 -> 33165484 (-3.101%)
SmallP2POldCsproj yes 5881835 -> 5800067 (-1.39%)
SmallP2PNewCsproj yes 10340682 -> 10217682 (-1.189%)
Generated_100_100_v150 yes 143419601 -> 138482239 (-3.443%)
LargeP2POldCsproj yes 83705415 -> 81511535 (-2.621%)
roslyn yes 403004965 -> 386487561 (-4.099%)

Build: Time (ms)

Test Overall Significant δ Value
DotnetConsoleProject 👌 no 23.0976 -> 23.1529 (0.239%)
DotnetWebProject ::ok_hand: no 28.3275 -> 28.3214 (-0.022%)
DotnetMvcProject 🔴 yes 31.3032 -> 31.5834 (0.895%)
Picasso yes 3129.9459 -> 3071.3088 (-1.873%)
SmallP2POldCsproj yes 151.2811 -> 148.7585 (-1.667%)
SmallP2PNewCsproj yes 157.7064 -> 156.9531 (-0.478%)

Build: Memory (bytes)

Test Overall Significant δ Value
DotnetConsoleProject 👌 no 1161445 -> 1161768 (0.028%)
DotnetWebProject 🔴 yes 1281363 -> 1284197 (0.221%)
DotnetMvcProject 🔴 yes 1458619 -> 1459441 (0.056%)
Picasso yes 121891367 -> 118498284 (-2.784%)
SmallP2POldCsproj yes 6149767 -> 6115086 (-0.564%)
SmallP2PNewCsproj yes 6414870 -> 6375686 (-0.611%)

@AndyGerlicher AndyGerlicher merged commit 9644404 into dotnet:vs15.5 Oct 23, 2017
return _fileMatcher;
}

_fileMatcher = CreateFileSpecMatcher();
Copy link
Member

Choose a reason for hiding this comment

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

This could be created multiple times is that a problem?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thought about that as well, but after looking at how it's called, it should be single threaded. Evaluation and Project apis are single threaded. Then even if they were multi threaded, the Itemspecs themselves would be thread local. If however, in the future, the itemspecs end up getting shared between threads then yes, this will be a problem.

Do you think it's worth prematurely making it thread safe again?

Copy link
Member

Choose a reason for hiding this comment

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

No, just wanted to make sure it was deliberate.

@cdmihai cdmihai deleted the GetAllGlobsOptimizations branch April 26, 2018 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants