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

[release/8.0] Improve perf of ActivatorUtilities.CreateInstance() #91881

Merged
merged 9 commits into from
Sep 11, 2023

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Sep 11, 2023

Backport of #91290 to release/8.0

/cc @steveharter

Customer Impact

Customers using DependencyInjection may see a significant performance regression (2-4x) to the ActivatorUtilities.CreateInstance() API and other APIs which call it. This regression was introduced with the "keyed services" feature that added in Preview 7 due to reading attributes on members.

9.0 PR: #91290
Perf issue: #91186

Testing

The existing tests are fairly thorough, but the fix added a cache that supports unloadable assemblies, so a new test was added for that. Note that assembly unloading is not supported on Mono or NativeAOT.

Risk

Low - the new cache is fairly straightforward, caching reflection-based metadata based on System.Type. Assembly unload-ability and Visual Studio hot reload have been accounted for.

@ghost
Copy link

ghost commented Sep 11, 2023

Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection
See info in area-owners.md if you want to be subscribed.

Issue Details

Backport of #91290 to release/8.0

/cc @steveharter

Customer Impact

Testing

Risk

IMPORTANT: If this backport is for a servicing release, please verify that:

  • The PR target branch is release/X.0-staging, not release/X.0.

  • If the change touches code that ships in a NuGet package, you have added the necessary package authoring and gotten it explicitly reviewed.

Author: github-actions[bot]
Assignees: -
Labels:

area-Extensions-DependencyInjection

Milestone: -

Copy link
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

LGTM, @artl93 can you please have a look?

@ericstj ericstj added the Servicing-consider Issue for next servicing release review label Sep 11, 2023
@ericstj ericstj added this to the 8.0.0 milestone Sep 11, 2023
@artl93
Copy link
Member

artl93 commented Sep 11, 2023

M2 approved.

@artl93 artl93 added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Sep 11, 2023
@carlossanlop carlossanlop merged commit 9819f18 into release/8.0 Sep 11, 2023
107 of 112 checks passed
@carlossanlop carlossanlop deleted the backport/pr-91290-to-release/8.0 branch September 11, 2023 23:24
@radical radical mentioned this pull request Sep 26, 2023
@ghost ghost locked as resolved and limited conversation to collaborators Oct 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants