Merge pull request #10208 from RoosterDragon/perf-comments

Added some performance comments
This commit is contained in:
atlimit8
2015-12-13 20:46:07 -06:00
28 changed files with 91 additions and 36 deletions

View File

@@ -84,10 +84,9 @@ namespace OpenRA.Traits
{
var wasVisible = Visible;
Shrouded = true;
// We are doing the following LINQ manually for performance since this is a hot path.
// Visible = !Footprint.Any(shroud.IsVisible);
Visible = true;
// PERF: Avoid LINQ.
foreach (var puv in Footprint)
{
if (shroud.IsVisible(puv))
@@ -128,7 +127,7 @@ namespace OpenRA.Traits
public bool ShouldBeRemoved(Player owner)
{
// We use a loop here for performance reasons
// PERF: Avoid LINQ.
foreach (var rfa in removeFrozenActors)
if (rfa.RemoveActor(actor, owner))
return true;