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

@@ -40,6 +40,7 @@ namespace OpenRA.Graphics
glyphs = new Cache<Pair<char, Color>, GlyphInfo>(CreateGlyph, Pair<char, Color>.EqualityComparer);
// PERF: Cache these delegates for Measure calls.
Func<char, float> characterWidth = character => glyphs[Pair.New(character, Color.White)].Advance;
lineWidth = line => line.Sum(characterWidth);

View File

@@ -22,6 +22,7 @@ namespace OpenRA.Graphics
{
public static bool Includes(this ScrollDirection d, ScrollDirection s)
{
// PERF: Enum.HasFlag is slower and requires allocations.
return (d & s) == s;
}