@@ -370,7 +370,6 @@ private object ResolveAndCache(int serviceTypeHash, Type serviceType, IfUnresolv
370
370
var rules = Rules;
371
371
if (!rules.UseInterpretationForTheFirstResolution)
372
372
{
373
- // todo: @perf @mem should we introduce the GetInstanceOrDefault to avoid lifting object ToFactoryDelegate, e.g. for InstanceFactory
374
373
factoryDelegate = factory.GetDelegateOrDefault(request);
375
374
request.ReturnToPool();
376
375
if (factoryDelegate == null)
@@ -8648,7 +8647,6 @@ public enum IsRegistryChangePermitted : byte
8648
8647
Ignored
8649
8648
}
8650
8649
8651
- // todo: @perf @memory split by IfUnresolved and separate the Metadata
8652
8650
/// <summary>Provides optional service resolution details: service key, required service type, what return when service is unresolved,
8653
8651
/// default value if service is unresolved, custom service value.</summary>
8654
8652
public sealed class ServiceDetails
@@ -9336,7 +9334,7 @@ internal static readonly RequestFlags InheritedFlags
9336
9334
9337
9335
internal static Request CreateForValidation(Container container, ServiceInfo serviceInfo, Request[] depRequestStack)
9338
9336
{
9339
- var req = RentRequest ();
9337
+ var req = RentRequestOrNull ();
9340
9338
return req == null
9341
9339
? req = new Request(container, Empty, 1, 0, depRequestStack, RequestFlags.IsResolutionCall, serviceInfo, serviceInfo.GetActualServiceType(), null)
9342
9340
: req.SetServiceInfo(container, Empty, 1, 0, depRequestStack, RequestFlags.IsResolutionCall, serviceInfo, serviceInfo.GetActualServiceType(), null);
@@ -9376,10 +9374,9 @@ public static Request CreateResolutionRoot(Container container, Type serviceType
9376
9374
if (serviceType != null && serviceType.IsOpenGeneric())
9377
9375
Throw.It(Error.ResolvingOpenGenericServiceTypeIsNotPossible, serviceType);
9378
9376
9379
- // todo: @mem @perf Could we avoid the allocation of the ServiceInfo details object for ifUnresolved? because it is unlucky path but we spend the memory on it upfront, especially given that ServiceProviderGetServiceShouldThrowIfUnresolved contains the adjusting value anyway???
9380
9377
object serviceInfo = ifUnresolved == IfUnresolved.Throw ? serviceType : ServiceDetails.Of(ifUnresolved);
9381
9378
9382
- var req = RentRequest ();
9379
+ var req = RentRequestOrNull ();
9383
9380
return req == null
9384
9381
? new Request(container, Empty, 1, 0, null, RequestFlags.IsResolutionCall, serviceInfo, serviceType, null)
9385
9382
: req.SetServiceInfo(container, Empty, 1, 0, null, RequestFlags.IsResolutionCall, serviceInfo, serviceType, null);
@@ -10142,7 +10139,7 @@ internal Request IsolateRequestChain()
10142
10139
}
10143
10140
10144
10141
private static Request _pooledRequest;
10145
- internal static Request RentRequest () => Interlocked.Exchange(ref _pooledRequest, null);
10142
+ internal static Request RentRequestOrNull () => Interlocked.Exchange(ref _pooledRequest, null);
10146
10143
internal void ReturnToPool()
10147
10144
{
10148
10145
if (_pooledRequest == null && (Flags & RequestFlags.DoNotPoolRequest) == 0)
0 commit comments