Minor Performance Optimization by Reducing Calls to AppDomain.CurrentDomain.FriendlyName
#8567
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
I have optimized the performance by reducing the number of times
AppDomain.CurrentDomain.FriendlyName
property is accessed. Accessing the FriendlyName property is not cheap and results in some additional performance overhead. By assigning it to a local variable first, I have managed to reduce multiple property accesses, thereby slightly improving performance without altering the existing logic.See https://github.com/dotnet/runtime/blob/222d4c5df0b63edb4dbb75771c6e0f8c1315746e/src/libraries/System.Private.CoreLib/src/System/AppDomain.cs#L65-L72
Customer Impact
Minor Performance Optimization
Regression
None.
Testing
Just CI.
Risk
Very Low?
Microsoft Reviewers: Open in CodeFlow