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

ExpandPropertiesLeaveTypedAndEscaped (incorrectly) makes the assumption that it's ReuseableStringBuilder won't be resized #4084

Closed
davkean opened this issue Jan 18, 2019 · 1 comment
Assignees
Labels
performance Performance-Scenario-Solution-Open This issue affects solution open performance. Priority:2 Work that is important, but not critical for the release triaged
Milestone

Comments

@davkean
Copy link
Member

davkean commented Jan 18, 2019

Opening a large 1000 project solution based on a solution with http://github.com/dotnet/project-system's project duplicated many times, I can see that 8.4% of all allocations during solution load (before we OOM) is ExpandPropertiesLeaveTypedAndEscaped expanding its ReuseableStringBuilder:

image

This seems to indicate that this is not required:

                    // This method is called very often - of the order of 3,000 times per project.
                    // With the reuseable string builder, there's no particular need to initialize the length as it will already have grown.
                    using (var result = new ReuseableStringBuilder())

I suspect we're not caching the builder because it's grown too big so the comment will be incorrect. We should set a sensible initial size based on what we're going to put inside it.

@ladipro
Copy link
Member

ladipro commented Aug 13, 2021

This was optimized by using SpanBasedConcatenator instead of ReuseableStringBuilder in #6128.

@ladipro ladipro closed this as completed Aug 13, 2021
@ladipro ladipro modified the milestones: Backlog, MSBuild 16.10 Dec 9, 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
performance Performance-Scenario-Solution-Open This issue affects solution open performance. Priority:2 Work that is important, but not critical for the release triaged
Projects
None yet
7 participants