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

ExpandExpressionCaptureIntoStringBuilder is spending ~4.8 of allocations resizing the string builder #2696

Closed
davkean opened this issue Nov 3, 2017 · 2 comments
Labels
backlog performance Performance-Scenario-Build This issue affects build 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 Nov 3, 2017

This is in a large mixed solution with collection of .NET Core and ASP.NET Core projects. Looking into this, we're resizing the underlying StringBuilder because it's default size isn't large enough when expanding an expression like @(Compile) (not @(Compile, '|') because there's not a lot of those).

We should change this method to figure out the up-front cost before allocating the stringbuilder:
image

@danmoseley
Copy link
Member

In the case of expanding @(Compile) it would be easy to start with # of entries in the item list multiplied by some factor like 10. Seems pretty unlikely to be over estimate.

@benvillalobos benvillalobos self-assigned this Apr 1, 2019
@panopticoncentral panopticoncentral added the Performance-Scenario-Build This issue affects build performance. label Mar 31, 2020
@panopticoncentral panopticoncentral added the Performance-Scenario-Solution-Open This issue affects solution open performance. label Jun 9, 2020
@panopticoncentral panopticoncentral added the Priority:2 Work that is important, but not critical for the release label Mar 23, 2021
@benvillalobos benvillalobos removed their assignment May 21, 2021
@ladipro
Copy link
Member

ladipro commented Aug 13, 2021

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

@ladipro ladipro closed this as completed Aug 13, 2021
@ladipro ladipro added this to the MSBuild 16.10 milestone 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
backlog performance Performance-Scenario-Build This issue affects build 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
Development

No branches or pull requests

7 participants