mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-15 03:30:53 +01:00
Avoid TLS lookup in IoCManager.Resolve<T>(ref T) if instance provided.
This commit is contained in:
@@ -203,9 +203,9 @@ namespace Robust.Shared.IoC
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T>([NotNull] ref T? instance)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
|
||||
_container.Value!.Resolve(ref instance);
|
||||
// Do not call into IDependencyCollection immediately for this,
|
||||
// avoids thread local lookup if instance is already given.
|
||||
instance ??= Resolve<T>()!;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Resolve{T}(ref T?)"/>
|
||||
|
||||
Reference in New Issue
Block a user