mirror of
https://github.com/space-wizards/RobustToolbox.git
synced 2026-02-14 19:29:36 +01:00
Remove AggressiveOptimization attributes.
This isn't a magic "make code go fast" button, none of these usages were correct.
This commit is contained in:
@@ -851,7 +851,6 @@ internal sealed partial class PvsSystem : EntitySystem
|
||||
return leftView.Count > 0 ? leftView : null;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
private void RecursivelyAddTreeNode(in EntityUid nodeIndex,
|
||||
RobustTree<EntityUid> tree,
|
||||
Dictionary<EntityUid, PvsEntityVisibility>? lastAcked,
|
||||
|
||||
@@ -101,7 +101,7 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Adds scalar b to a and stores the result in a.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Add(Span<float> a, float b)
|
||||
{
|
||||
Add(a, b, a);
|
||||
@@ -110,7 +110,7 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Adds scalar b to a and stores the result in s.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Add(ReadOnlySpan<float> a, float b, Span<float> s)
|
||||
{
|
||||
if (a.Length != s.Length)
|
||||
@@ -125,7 +125,7 @@ namespace Robust.Shared.Maths
|
||||
Add128(a, b, s);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void AddScalar(ReadOnlySpan<float> a, float b, Span<float> s, int start, int end)
|
||||
{
|
||||
for (var i = start; i < end; i++)
|
||||
@@ -134,7 +134,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void Add128(ReadOnlySpan<float> a, float b, Span<float> s)
|
||||
{
|
||||
var remainder = a.Length & (Vector128<float>.Count - 1);
|
||||
@@ -159,7 +159,7 @@ namespace Robust.Shared.Maths
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static void Add256(ReadOnlySpan<float> a, float b, Span<float> s)
|
||||
{
|
||||
var remainder = a.Length & (Vector256<float>.Count - 1);
|
||||
@@ -191,7 +191,7 @@ namespace Robust.Shared.Maths
|
||||
/// <summary>
|
||||
/// Adds all elements of a and returns the value.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static float HorizontalAdd(ReadOnlySpan<float> a)
|
||||
{
|
||||
if (Vector256Enabled && LengthValid256Single(a.Length))
|
||||
@@ -202,7 +202,7 @@ namespace Robust.Shared.Maths
|
||||
return HorizontalAdd128(a);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float HorizontalAddScalar(ReadOnlySpan<float> a, int start, int end)
|
||||
{
|
||||
var sum = 0f;
|
||||
@@ -215,7 +215,7 @@ namespace Robust.Shared.Maths
|
||||
return sum;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float HorizontalAdd128(ReadOnlySpan<float> a)
|
||||
{
|
||||
var remainder = a.Length & 3;
|
||||
@@ -242,7 +242,7 @@ namespace Robust.Shared.Maths
|
||||
return sum;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static float HorizontalAdd256(ReadOnlySpan<float> a)
|
||||
{
|
||||
var remainder = a.Length & 7;
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <param name="logMissing">Whether to log missing components.</param>
|
||||
/// <typeparam name="TComp">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the component is not null or was resolved correctly, false if the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp>(EntityUid uid, [NotNullWhen(true)] ref TComp? component, bool logMissing = true)
|
||||
where TComp : IComponent
|
||||
{
|
||||
@@ -42,7 +42,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <typeparam name="TComp1">The component type to resolve.</typeparam>
|
||||
/// <typeparam name="TComp2">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the components are not null or were resolved correctly, false if any of the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp1, TComp2>(EntityUid uid, [NotNullWhen(true)] ref TComp1? comp1, [NotNullWhen(true)] ref TComp2? comp2, bool logMissing = true)
|
||||
where TComp1 : IComponent
|
||||
where TComp2 : IComponent
|
||||
@@ -62,7 +62,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <typeparam name="TComp2">The component type to resolve.</typeparam>
|
||||
/// <typeparam name="TComp3">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the components are not null or were resolved correctly, false if any of the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp1, TComp2, TComp3>(EntityUid uid, [NotNullWhen(true)] ref TComp1? comp1, [NotNullWhen(true)] ref TComp2? comp2, [NotNullWhen(true)] ref TComp3? comp3, bool logMissing = true)
|
||||
where TComp1 : IComponent
|
||||
where TComp2 : IComponent
|
||||
@@ -85,7 +85,7 @@ namespace Robust.Shared.GameObjects
|
||||
/// <typeparam name="TComp3">The component type to resolve.</typeparam>
|
||||
/// <typeparam name="TComp4">The component type to resolve.</typeparam>
|
||||
/// <returns>True if the components are not null or were resolved correctly, false if any of the component couldn't be resolved.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
protected bool Resolve<TComp1, TComp2, TComp3, TComp4>(EntityUid uid, [NotNullWhen(true)] ref TComp1? comp1, [NotNullWhen(true)] ref TComp2? comp2, [NotNullWhen(true)] ref TComp3? comp3, [NotNullWhen(true)] ref TComp4? comp4, bool logMissing = true)
|
||||
where TComp1 : IComponent
|
||||
where TComp2 : IComponent
|
||||
|
||||
@@ -72,14 +72,14 @@ namespace Robust.Shared.GameObjects
|
||||
return system;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T>([NotNull] ref T? instance)
|
||||
where T : IEntitySystem
|
||||
{
|
||||
_systemDependencyCollection.Resolve(ref instance);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2)
|
||||
where T1 : IEntitySystem
|
||||
where T2 : IEntitySystem
|
||||
@@ -87,7 +87,7 @@ namespace Robust.Shared.GameObjects
|
||||
_systemDependencyCollection.Resolve(ref instance1, ref instance2);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3)
|
||||
where T1 : IEntitySystem
|
||||
where T2 : IEntitySystem
|
||||
@@ -96,7 +96,7 @@ namespace Robust.Shared.GameObjects
|
||||
_systemDependencyCollection.Resolve(ref instance1, ref instance2, ref instance3);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3, T4>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3, [NotNull] ref T4? instance4)
|
||||
where T1 : IEntitySystem
|
||||
where T2 : IEntitySystem
|
||||
|
||||
@@ -332,21 +332,21 @@ namespace Robust.Shared.IoC
|
||||
return (T)ResolveType(typeof(T));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T>([NotNull] ref T? instance)
|
||||
{
|
||||
// Resolve<T>() will either throw or return a concrete instance, therefore we suppress the nullable warning.
|
||||
instance ??= Resolve<T>()!;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2)
|
||||
{
|
||||
Resolve(ref instance1);
|
||||
Resolve(ref instance2);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2,
|
||||
[NotNull] ref T3? instance3)
|
||||
{
|
||||
@@ -354,7 +354,7 @@ namespace Robust.Shared.IoC
|
||||
Resolve(ref instance3);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Resolve<T1, T2, T3, T4>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2,
|
||||
[NotNull] ref T3? instance3, [NotNull] ref T4? instance4)
|
||||
{
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace Robust.Shared.IoC
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="Resolve{T}()"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T>([NotNull] ref T? instance)
|
||||
{
|
||||
// Do not call into IDependencyCollection immediately for this,
|
||||
@@ -213,7 +213,7 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Resolve two dependencies manually.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T1, T2>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
@@ -225,7 +225,7 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Resolve three dependencies manually.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T1, T2, T3>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
@@ -237,7 +237,7 @@ namespace Robust.Shared.IoC
|
||||
/// <summary>
|
||||
/// Resolve four dependencies manually.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.AggressiveInlining)]
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static void Resolve<T1, T2, T3, T4>([NotNull] ref T1? instance1, [NotNull] ref T2? instance2, [NotNull] ref T3? instance3, [NotNull] ref T4? instance4)
|
||||
{
|
||||
DebugTools.Assert(_container.IsValueCreated, NoContextAssert);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace Robust.Shared.Physics
|
||||
|
||||
public int MaxBalance
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
var maxBal = 0;
|
||||
@@ -130,7 +130,7 @@ namespace Robust.Shared.Physics
|
||||
|
||||
public float AreaRatio
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
get
|
||||
{
|
||||
if (_root == Proxy.Free)
|
||||
@@ -387,7 +387,7 @@ namespace Robust.Shared.Physics
|
||||
return _nodes[proxy].Aabb;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void RemoveLeaf(Proxy leaf)
|
||||
{
|
||||
if (leaf == _root)
|
||||
@@ -562,7 +562,7 @@ namespace Robust.Shared.Physics
|
||||
return cost;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void Balance(Proxy index)
|
||||
{
|
||||
while (index != Proxy.Free)
|
||||
@@ -755,7 +755,7 @@ namespace Robust.Shared.Physics
|
||||
/// <summary>
|
||||
/// Compute the height of a sub-tree.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private int ComputeHeight(Proxy proxy)
|
||||
{
|
||||
ref var node = ref _nodes[proxy];
|
||||
@@ -770,7 +770,7 @@ namespace Robust.Shared.Physics
|
||||
) + 1;
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public void RebuildBottomUp(int free = 0)
|
||||
{
|
||||
var proxies = new Proxy[NodeCount + free];
|
||||
@@ -909,7 +909,6 @@ namespace Robust.Shared.Physics
|
||||
|
||||
public delegate void FastQueryCallback(ref T userData);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization)]
|
||||
public void FastQuery(ref Box2 aabb, FastQueryCallback callback)
|
||||
{
|
||||
var stack = new GrowableStack<Proxy>(stackalloc Proxy[256]);
|
||||
|
||||
@@ -175,7 +175,7 @@ namespace Robust.Shared.Physics
|
||||
bool ICollection<T>.Remove(T item)
|
||||
=> Remove(item);
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
public bool Update(in T item, Box2? newBox = null)
|
||||
{
|
||||
if (!TryGetProxy(item, out var proxy))
|
||||
|
||||
@@ -57,20 +57,11 @@ public interface IBroadPhase<T> : ICollection<T> where T : notnull {
|
||||
|
||||
int Capacity { get; }
|
||||
|
||||
int Height {
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get;
|
||||
}
|
||||
int Height { get; }
|
||||
|
||||
int MaxBalance {
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
get;
|
||||
}
|
||||
int MaxBalance { get; }
|
||||
|
||||
float AreaRatio {
|
||||
[MethodImpl(MethodImplOptions.AggressiveOptimization | MethodImplOptions.NoInlining)]
|
||||
get;
|
||||
}
|
||||
float AreaRatio { get; }
|
||||
|
||||
bool Add(in T item, Box2? newAABB = null);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user