-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Conversation
…onstructorInvoker for possible risk of callstack usage
Tagging subscribers to this area: @dotnet/area-extensions-dependencyinjection Issue DetailsBackport of #91290 to release/8.0 /cc @steveharter Customer ImpactTestingRiskIMPORTANT: If this backport is for a servicing release, please verify that:
|
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.
LGTM, @artl93 can you please have a look?
M2 approved. |
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.