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

Reduce ExtractPropertyFunction Allocations #4364

Conversation

benvillalobos
Copy link
Member

Meant to fix #4085 but can't seem to repro & prove the fix works.

Reduced allocations by making use of ReadOnlySpan. Previous functionality saw lots of .Substring() and .Trim() calls on strings. Now they're being called on ReadOnlySpan and aren't turned into strings until needed at the end of the function.

Copy link
Member

@rainersigwald rainersigwald left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocked only on setup authoring.

src/Build/Evaluation/Expander.cs Show resolved Hide resolved
src/Build/Evaluation/Expander.cs Outdated Show resolved Hide resolved
@@ -33,6 +33,7 @@

<PackageReference Include="System.Collections.Immutable" />
<PackageReference Include="System.Threading.Tasks.Dataflow" />
<PackageReference Include="System.Memory" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will require some Setup Magic, so that we have it available in VS setup.

Notes for that: #3947, https://github.com/microsoft/msbuild/pull/3648/files#diff-ebf6dde28bf300b10540e8b71b872c5d.

Let's sync on that and pair through it (maybe next week while I'm there?).

functionBuilder.Arguments = functionArguments;
functionBuilder.BindingFlags = defaultBindingFlags;
functionBuilder.Remainder = remainder;
functionBuilder.Remainder = remainder.ToString();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this still shows as a hot spot for allocations, we'll probably have to tackle FunctionBuilder's need to make these into real strings. But what you've done should help quite a bit and is a great start, so I think we should take this as-is.

@@ -161,6 +163,8 @@ folder InstallDir:\MSBuild\Current\Bin\amd64
file source=$(X86BinPath)Microsoft.Build.Framework.dll vs.file.ngenArchitecture=all
file source=$(X86BinPath)Microsoft.Build.Tasks.Core.dll vs.file.ngenArchitecture=all
file source=$(X86BinPath)Microsoft.Build.Utilities.Core.dll vs.file.ngenArchitecture=all
file source=$(X86BinPath)System.Memory.dll vs.file.ngenArchitecture=all
file source=$(X86BinPath)System.Numerics.Vectors.dll vs.file.ngenArchitecture=all
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did RPS pass on your trial insertion to VS? This caused problems there last time. If it passed, awesome ;)

@benvillalobos
Copy link
Member Author

Superseded by #4394

@benvillalobos benvillalobos deleted the extractpropertyfunction-allocations branch May 22, 2019 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ExtractPropertyFunction allocates a huge amount of data during solution load
5 participants