Added comments in performance sensitive code.

This commit is contained in:
RoosterDragon
2015-12-04 19:38:20 +00:00
parent aaa82339d1
commit b0619a3e25
22 changed files with 76 additions and 11 deletions

View File

@@ -34,6 +34,9 @@ namespace OpenRA
}
}
/// <summary>
/// Provides efficient ways to query a set of actors by their traits.
/// </summary>
class TraitDictionary
{
static readonly Func<Type, ITraitContainer> CreateTraitContainer = t =>
@@ -161,6 +164,7 @@ namespace OpenRA
public IEnumerable<T> GetMultiple(uint actor)
{
// PERF: Custom enumerator for efficiency - using `yield` is slower.
++Queries;
return new MultipleEnumerable(this, actor);
}
@@ -197,6 +201,7 @@ namespace OpenRA
public IEnumerable<TraitPair<T>> All()
{
// PERF: Custom enumerator for efficiency - using `yield` is slower.
++Queries;
return new AllEnumerable(this);
}