dadhi / DryIoc

DryIoc is fast, small, full-featured IoC Container for .NET
MIT License
1.03k stars 122 forks source link

[MS.DI] Add the Rules.HotService field to store the DryIocServiceProviderCapabilities object for fast resolution #481

Closed dadhi closed 10 months ago

dadhi commented 2 years ago

Currently, MS.DI when creating a scope calls the Resolve/GetRequiredService for the IServiceScopeFactory.

The IServiceScopeFactory is implemented by DryIocServiceProviderCapabilities which object is created in DryIoc MS.DI adapter and the stored in singleton scope via Use method. There are 3 entries in Used collection storing all the capabilities also including IServiceProviderIsService and ISupportRequiredService (the latter is the subject for the other issue #TBD).

As the Used objects are general purpose and given that the used collection is not empty now, means that every Resolution and Injection will examine and waste some time to check the Used objects.

TBD the details of why Use is slow on the hot path

dadhi commented 10 months ago

Outdated, now capabilities are saved into the DryIocServiceProvider

dadhi commented 10 months ago

Ok, but the HotService is the interesting idea.