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

Communication between VS -> MSBuild is pushing 6% (100MB) of allocations onto the LOH #3953

Closed
Tracked by #6940
davkean opened this issue Nov 22, 2018 · 7 comments
Closed
Tracked by #6940
Assignees
Labels
Area: Engine Issues impacting the core execution of targets and tasks. performance Performance-Scenario-Solution-Open This issue affects solution open performance. Priority:2 Work that is important, but not critical for the release size:1 triaged
Milestone

Comments

@davkean
Copy link
Member

davkean commented Nov 22, 2018

We're attempting to quadruple the number of projects that the project system can open, while at same reducing solution load time. Reducing GC time is an important part of that.

In one trace where we are opening 780 projects, I'm seeing ~50 MB pushed on the large object heap (LOH) during the communication between VS and MSBuild.

It would reduce the amount of data we pushed on the LOH (and forced Gen2 collection) if we chunked this data up into arrays that were less than 85K.

GC Rollup By Generation

Gen Count MaxPause MaxPeak MB Max AllocMB/sec TotalPause TotalAlloc MB Alloc MB/MSec GC Survived MB/MSec GC MeanPause Induced
ALL 426 741.5 4,106.9 1,112.349 9,601.4 2,118.8 0.2 0.269 22.5 7
0 282 35.3 2,087.1 1,112.349 3,548.3 1,389.3 1.7 0.029 12.6 0
1 138 63.7 4,106.9 396.323 2,764.4 709.1 1.3 0.025 20.0 1
2 6 741.5 2,070.8 10.006 3,288.7 20.3 1.6 0.369 548.1 6

image

image

@davkean davkean changed the title Communication between VS -> MSBuild is pushing 3% (50MB) of allocations onto the LOH Communication between VS -> MSBuild is pushing 6% (100MB) of allocations onto the LOH Nov 22, 2018
@livarcocc livarcocc added this to the MSBuild 16.0 milestone Nov 22, 2018
@davkean
Copy link
Member Author

davkean commented Nov 23, 2018

Here's a trace for 520 projects (above is for 780), similar problem:

image

@davkean
Copy link
Member Author

davkean commented Jan 17, 2019

Here's a trace that allocates 25% of all allocations during solution load on the LOH due to MSBuild:

image

@rainersigwald
Copy link
Member

@benvillalobos can you check current relevance of this after the latest project system changes?

@danmoseley
Copy link
Member

Maybe the stream passed to BinaryWriter could be some custom (subclass of?) MemoryStream that allocated in sizes that are more friendly to the LOH (?)

@benvillalobos benvillalobos self-assigned this Oct 8, 2019
@rainersigwald rainersigwald added Area: Engine Issues impacting the core execution of targets and tasks. performance labels Mar 20, 2020
@rainersigwald rainersigwald modified the milestones: MSBuild 16.6, Backlog Mar 20, 2020
@panopticoncentral panopticoncentral added the Performance-Scenario-Solution-Open This issue affects solution open performance. label Mar 31, 2020
@panopticoncentral panopticoncentral added the Priority:2 Work that is important, but not critical for the release label Mar 23, 2021
@ladipro ladipro added the size:1 label Oct 12, 2021
@ladipro
Copy link
Member

ladipro commented Oct 12, 2021

Labeling with size:1 as the cost of the initial investigation. Will open a follow-up issue if more work is identified.

@ladipro ladipro self-assigned this Nov 8, 2021
@ladipro
Copy link
Member

ladipro commented Nov 16, 2021

Code inspection:

We should be much better off now. Let's measure.

@ladipro
Copy link
Member

ladipro commented Nov 16, 2021

Confirmed by recording a trace opening a 1000 project solution in 17.1.0 Preview 2.0 [31915.365.main.

  • ~2 MB worth of LOH char[] allocations coming from the InterningBinaryReader.
  • No byte[] LOH allocations coming from MSBuild.

image

@ladipro ladipro closed this as completed Nov 16, 2021
@ladipro ladipro moved this from In Progress to Done in Perf sprint Nov 8th - Nov 21st 2021 Nov 16, 2021
@ladipro ladipro modified the milestones: Backlog, VS 17.0 Dec 8, 2021
@AR-May AR-May added the triaged label Feb 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Engine Issues impacting the core execution of targets and tasks. performance Performance-Scenario-Solution-Open This issue affects solution open performance. Priority:2 Work that is important, but not critical for the release size:1 triaged
Development

No branches or pull requests

8 participants