Skip to content

Conversation

@ladipro
Copy link
Member

@ladipro ladipro commented Jun 20, 2023

Context

Low-hanging fruit is showing in RAR performance profiles.

Changes Made

  1. Avoided constructing AssemblyName on a hot path as the constructor makes expensive Fusion calls on .NET Framework. The problematic code was introduced in [RAR] Don't do I/O on SDK-provided references #8688.

  2. Added a metadata bulk-set operation to the internal IMetadataContainer interface. Calling SetMetadata for more than a couple of metadata is slow if ImmutableDictionary is used as its backing storage. RAR is heavy on metadata manipulation and switching to the new operation saves about 10% of RAR run-time when building OrchardCore.

Testing

Existing and new unit tests. Measured the perf impact by building OC.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

Simple and effective - I do not have anything to criticize here

@ladipro ladipro merged commit 1ff019a into dotnet:main Jul 10, 2023
@ladipro ladipro deleted the rar-cpu-optimizations branch July 10, 2023 12:43
JaynieBai added a commit that referenced this pull request Jul 12, 2023
JaynieBai added a commit that referenced this pull request Jul 14, 2023
This reverts commit 1ff019a.

Fixes #
VS Insertion, C++ Project System - PR: VC.ProjectSystem.VCProject.CachedProjectAutomation fails since these changes.
https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_git/VS/pullRequest/483186#1689247828

So far I know the problem is in 1ff019a#diff-20c3f77300d596d35264f7f9351652e233cb3455c3f7a7262df4842d437fe8efR1407-R1414 but let's revert for now to unblock insertions. Thank you!
ladipro added a commit to ladipro/msbuild that referenced this pull request Jul 17, 2023
YuliiaKovalova pushed a commit to YuliiaKovalova/msbuild that referenced this pull request Jul 18, 2023
### Context

Low-hanging fruit is showing in RAR performance profiles.

### Changes Made

1. Avoided constructing `AssemblyName` on a hot path as the constructor makes expensive Fusion calls on .NET Framework. The problematic code was introduced in dotnet#8688.

2. Added a metadata bulk-set operation to the internal `IMetadataContainer` interface. Calling `SetMetadata` for more than a couple of metadata is slow if `ImmutableDictionary` is used as its backing storage. RAR is heavy on metadata manipulation and switching to the new operation saves about 10% of RAR run-time when building OrchardCore. 

### Testing

Existing and new unit tests. Measured the perf impact by building OC.

---------

Co-authored-by: Rainer Sigwald <[email protected]>
YuliiaKovalova pushed a commit to YuliiaKovalova/msbuild that referenced this pull request Jul 18, 2023
…tnet#9037)

This reverts commit 1ff019a.

Fixes #
VS Insertion, C++ Project System - PR: VC.ProjectSystem.VCProject.CachedProjectAutomation fails since these changes.
https://devdiv.visualstudio.com/DefaultCollection/DevDiv/_git/VS/pullRequest/483186#1689247828

So far I know the problem is in 1ff019a#diff-20c3f77300d596d35264f7f9351652e233cb3455c3f7a7262df4842d437fe8efR1407-R1414 but let's revert for now to unblock insertions. Thank you!
JaynieBai pushed a commit that referenced this pull request Jul 27, 2023
#8916 broke some .NET Framework scenarios and was reverted. This PR is a redo of the change with the bug fixed. It turned out that the destination of the optimized CopyMetadataTo may be a transparent proxy, typically a TaskItem object living in another appdomain, which does not work well with Linq. The fix and the test coverage are in their own commits.

Context
Low-hanging fruit is showing in RAR performance profiles.

Changes Made
Avoided constructing AssemblyName on a hot path as the constructor makes expensive Fusion calls on .NET Framework. The problematic code was introduced in [RAR] Don't do I/O on SDK-provided references #8688.

Added a metadata bulk-set operation to the internal IMetadataContainer interface. Calling SetMetadata for more than a couple of metadata is slow if ImmutableDictionary is used as its backing storage. RAR is heavy on metadata manipulation and switching to the new operation saves about 10% of RAR run-time when building OrchardCore.

Testing
Existing and new unit tests. Measured the perf impact by building OC.
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.

3 participants