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
Optimize property expansion #6128
Conversation
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.
Cool stuff. The only thing to think about is if in a disposable type, you wish to check if instances have already been disposed prior to executing public method bodies.
483dd9e
to
2bd3656
Compare
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.
Thank you @donJoseLuis. I have addressed your feedback and updated the PR.
I feel like there was a rumor of eventually replacing Expander entirely, but I might be misremembering. |
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.
Looks great! Did you get a sense of how many properties were being expanded that only had a single object?
2bd3656
to
6b55daa
Compare
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.
I feel like there was a rumor of eventually replacing Expander entirely, but I might be misremembering.
That would be exciting (and scary at the same time). Any pointers to such plans would be welcome!
I looked around, and what I found suggested no concrete plans—just an idea: I was probably a little premature here 🙂 |
That's a great question. When building a .NET Core hello world console app, out of 5632 invocations of
|
6b55daa
to
86b65b7
Compare
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.
thanks for updating to check if instances are disposed in public members.
…urn null (#6414) Fixes #6413 ### Context This is a regression introduced in #6128. MSBuild crashes when evaluating a project where a property function returns null and its result is concatenated with another non-empty value. ### Changes Made Add a null check. ### Testing Fixed and extended the relevant test case.
.NET SDK 5.0.300 ships with MSBuild 16.10, which optimizes away the implicit expansion of quoted property lists [*]: FSC : warning FS0203: Invalid warning number '3218 3390' Fortunately this old (non-portable) workaround still works: dotnet/sdk#8792 (comment) ---- [*] dotnet/msbuild#6128
Fixes #6063
Context
Property expansion has been identified as one of the hot spots in project evaluation and
ExpandPropertiesLeaveEscaped
aloneaccounts for almost 20% of overall evaluation time of simple projects.
Changes Made
Several optimizations have been made to the calltree under
ExpandPropertiesLeaveEscaped
. Notably:strchr
-like function has been replaced with a simple call toString.IndexOf
.if
s have been replaced with aswitch
.List<object> results
has been eliminated.The combined performance win is 10% in
ExpandPropertiesLeaveEscaped
, so close to 2% for evaluation overall.Testing
Expander is well covered by existing unit tests.
Notes
Please review commit by commit for easier to read diffs.