remove another 40M/min of boxing junk by specializing the key comparer on SpriteFont's dict

This commit is contained in:
Chris Forbes
2011-03-06 08:59:25 +13:00
parent 8d1a69e8ff
commit 69ea44310b
2 changed files with 11 additions and 2 deletions

View File

@@ -60,7 +60,15 @@ namespace OpenRA.FileFormats
public override string ToString()
{
return "({0},{1})".F(First, Second);
}
}
class PairEqualityComparer : IEqualityComparer<Pair<T, U>>
{
public bool Equals(Pair<T, U> x, Pair<T, U> y) { return x == y; }
public int GetHashCode(Pair<T, U> obj) { return obj.GetHashCode(); }
}
public static IEqualityComparer<Pair<T, U>> EqualityComparer { get { return new PairEqualityComparer(); } }
}
public static class Pair