Closed SergeiPavlov closed 8 months ago
Attention: 2 lines
in your changes are missing coverage. Please review.
Comparison is base (
5af8326
) 78.47% compared to head (095a0c3
) 78.49%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Hi @SergeiPavlov, could you please run a few of our benchmarks (I'm thinking DeepGraphResolve and ChildScopeResolve at least) and show before and after numbers here to prove that the benefit of allocation removal outweighs the one or two places we copy ResolveRequest
into a class field in terms of the size of those classes and the copy time?
If you're unsure on how to run our benchmarks (under the 'bench' folder), let me know.
Sure. Here are the results:
Branch develop:
ChildScopeResolve
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
Resolve | 26.78 us | 0.277 us | 0.272 us | 3.7231 | 1.8311 | 30.51 KB |
ResolveNeverRegisteredFromChild | 13.15 us | 0.067 us | 0.053 us | 2.0905 | 1.0376 | 17.1 KB |
DeepGraphResolve
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
Resolve | 9.775 us | 0.0253 us | 0.0249 us | 1.7700 | 0.0458 | 14.54 KB |
==============
Branch struct_ResolveRequest (THIS)
ChildScopeResolve
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
Resolve | 26.97 us | 0.270 us | 0.341 us | 3.6621 | 1.8005 | 30.13 KB |
ResolveNeverRegisteredFromChild | 12.87 us | 0.033 us | 0.029 us | 2.0905 | 1.0376 | 17.12 KB |
DeepGraphResolve
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
---|---|---|---|---|---|---|
Resolve | 9.438 us | 0.1794 us | 0.2395 us | 1.6937 | 0.0305 | 13.85 KB |
Related: autofac/Autofac.Extensions.DependencyInjection#112
I'm not sure we can support M.E.DI keyed services without core Autofac changes. If we have to cut a new/breaking version for .NET 8, it might be worth trying to get these keyed service updates in place at the same time or we could end up with two breaking changes in a row.
This will save GC work (one allocation per resolving). Also:
GetOrCreateInstanceThrowsArgumentNullExceptionWhenResolveRequestIsNull
test as not-applicable anymorein
function argument specifier to pass pointer instead of struct contents.