fix: Eliminates List allocations in various places. (#2158)

This commit is contained in:
Kamron Batman 2025-11-16 18:33:53 -08:00 • committed by GitHub
parent 6f64cddd0b
commit 4836bff5eb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
23 changed files with 263 additions and 200 deletions

View file

@ -33,8 +33,10 @@ namespace Server.Commands.Generic
if (mobiles)
{
foreach (var mob in reg.GetMobiles())
using var mobileList = reg.GetMobilesPooled();
for (var i = 0; i < mobileList.Count; i++)
{
var mob = mobileList[i];
if (BaseCommand.IsAccessible(from, mob) && ext.IsValid(mob))
{
list.Add(mob);
@ -44,7 +46,8 @@ namespace Server.Commands.Generic
if (items)
{
foreach (var item in reg.GetItems())
using var itemList = reg.GetItemsPooled();
foreach (var item in itemList)
{
if (BaseCommand.IsAccessible(from, item) && ext.IsValid(item))
{