Misc changes to reduce allocation:
- Avoid creating new strings in SpriteRenderer.Flush. - ProductionQueue.CancelUnbuildableItems can exit early if the queue is empty. It can also use a set of names for quicker lookups. - OpenGL.CheckGLError avoids a Enum.HasFlag call.
This commit is contained in:
@@ -309,7 +309,10 @@ namespace OpenRA.Mods.Common.Traits
|
||||
|
||||
protected void CancelUnbuildableItems()
|
||||
{
|
||||
var buildableNames = BuildableItems().Select(b => b.Name).ToList();
|
||||
if (Queue.Count == 0)
|
||||
return;
|
||||
|
||||
var buildableNames = BuildableItems().Select(b => b.Name).ToHashSet();
|
||||
|
||||
// EndProduction removes the item from the queue, so we enumerate
|
||||
// by index in reverse to avoid issues with index reassignment
|
||||
|
||||
Reference in New Issue
Block a user