From 3a166e14230650f7d0dc40c370898d02b3206a83 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sun, 31 Dec 2023 03:12:52 +1100 Subject: [PATCH] Reduce shuttle smimsh allocations (#22952) --- .../Shuttles/Systems/ShuttleSystem.FasterThanLight.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs index 763e89e4f8..636470e2e5 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.FasterThanLight.cs @@ -77,6 +77,8 @@ public sealed partial class ShuttleSystem /// public const float FTLDestinationMass = 500f; + private HashSet _lookupEnts = new(); + private EntityQuery _bodyQuery; private EntityQuery _buckleQuery; private EntityQuery _ghostQuery; @@ -716,8 +718,10 @@ public sealed partial class ShuttleSystem // Handle clearing biome stuff as relevant. tileSet.Clear(); _biomes.ReserveTiles(xform.MapUid.Value, aabb, tileSet); + _lookupEnts.Clear(); + _lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, _lookupEnts, LookupFlags.Uncontained); - foreach (var ent in _lookup.GetEntitiesIntersecting(xform.MapUid.Value, aabb, LookupFlags.Uncontained)) + foreach (var ent in _lookupEnts) { if (ent == uid || immune.Contains(ent)) { -- 2.51.2