From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 30 Dec 2023 16:12:52 +0000 (+1100) Subject: Reduce shuttle smimsh allocations (#22952) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3a166e14230650f7d0dc40c370898d02b3206a83;p=space-station-14.git Reduce shuttle smimsh allocations (#22952) --- 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)) {