-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Load all projects as read-only in MSBuild.exe #3584
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
Conversation
DesignTimeBuild Time (ms) (src\msbuild vs src\msbuild.jeff)
DesignTimeBuild Memory (bytes) (src\msbuild vs src\msbuild.jeff)
SerialEvaluationIsolatedContext Time (ms) (src\msbuild vs src\msbuild.jeff)
SerialEvaluationIsolatedContext Memory (bytes) (src\msbuild vs src\msbuild.jeff)
SerialEvaluationSharedContextSecondRun Time (ms) (src\msbuild vs src\msbuild.jeff)
SerialEvaluationSharedContextSecondRun Memory (bytes) (src\msbuild vs src\msbuild.jeff)
SerialEvaluationSharedContext Time (ms) (src\msbuild vs src\msbuild.jeff)
SerialEvaluationSharedContext Memory (bytes) (src\msbuild vs src\msbuild.jeff)
|
rainersigwald
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Waiting on the breaking(?) change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this a breaking change? IIRC optional arguments are compiled into the consumer, so they can't be added without breaking and you have to add an overload instead.
src/Build/Xml/XmlReaderExtension.cs
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add trailing comma
|
@AndyGerlicher do the perf numbers indicate if this change is worth it? I can't decipher them... |
|
Really hard to tell - do you trust those numbers at all? It shows a large reduction in design-time build memory, but then regresses SerialEvaluationSharedContextSecondRun memory whatever that's doing. |
Uses XmlReaderSettings to ignore comments and whitespace for all projects. At the moment we read comments but then report the content as just String.Empty. The XmlReader still allocates a string for us which we immediately throw away. This change adds a setting to ProjectCollection so that all projects loaded in the collection are treated as read-only. For command-line builds, a ProjectCollection is created for the build episode. End-users can create their own ProjectCollection with the setting as well. Fixes dotnet#2576
Fixes #2576 ### Context The code already has support for parsing project files as read-only when we know that we're not going to be asked to write them back to disk. This flag is currently unused because the initial implementation in #3584 introduced a regression related to whitespace in attribute values (#4210). ### Changes Made Trivially reverted part of #4213 that addressed the regression and added a hack to make `XmlReader` behave the same as `XmlTextReader`. ### Testing Existing unit tests for correctness and ETW for performance. `XmlDocumentWithLocation.Load()` is ~26% faster with this change compared to baseline when building .NET Core projects. This translates to about 10 ms per one incremental CLI build of a Hello world application.
Uses
XmlReaderSettingsto ignore comments and whitespace for all projects. At the moment we read comments but then report the content as justString.Empty. TheXmlReaderstill allocates a string for us which we immediately throw away.This change adds a setting to
ProjectCollectionso that all projects loaded in the collection are treated as read-only. For command-line builds, a ProjectCollection is created for the build episode. End-users can create their own ProjectCollection with the setting as well.Fixes #2576