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

Delay formatting msbuild resources until they get consumed by a Stream #3599

Closed
cdmihai opened this issue Aug 9, 2018 · 2 comments
Closed

Comments

@cdmihai
Copy link
Contributor

cdmihai commented Aug 9, 2018

Formatted msbuild resource strings eventually get sent to loggers, which eventually write them to some stream. Most StreamWriters have overloads (or will have) for formatting. Therefore it is pointless to convert formatted resources into strings, if they're final resting place is some buffer anyway.

An interesting experiment would be to put the resource and its arguments into some struct, and then propagate that struct all the way into loggers, which then can format them directly into their streams / string builders / etc.

Building WebLargeCore with minimal verbosity creates 74mb of formatted resources:

image

And in a broader sense, we should look for cases where we strinbbuild or format strings just to then later put them in some buffer. Patterns that will help

  • switch to using ReadOnlyMemory instead of strings
  • future corefx work will allow us to retrieve the buffers from stringbuilders
  • use formatting overloads
@rokonec
Copy link
Member

rokonec commented Apr 16, 2021

I believe most of this has been addressed by LazyFormattedBuildEventArgs. There was a bug related to minimal verbosity and improper usage of LazyFormattedBuildEventArgs - #5924

@rokonec rokonec closed this as completed Apr 16, 2021
@rokonec
Copy link
Member

rokonec commented Apr 16, 2021

Please reopen if it remains relevant.

@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
Projects
None yet
Development

No branches or pull requests

5 participants