Fix strange d2k loading slowness

There is a strange issue that appears* when Theater calls
ISpriteFrame.Frames on the R8Reader. The R8Reader uses
IEnumerable.Cast<> which behaves slower and slower, which
makes map loading become 10+ times slower.

The changes here simply avoid the casting.

[*] This happens at least on Linux x86_64 with Mono 3.2.8.

See https://bugzilla.xamarin.com/show_bug.cgi?id=19668
This commit is contained in:
Pavlos Touboulidis
2014-05-11 05:55:38 +03:00
parent 17d3bc27ce
commit 2ec6df9680
8 changed files with 22 additions and 13 deletions

View File

@@ -51,8 +51,8 @@ namespace OpenRA.FileFormats
public class TmpTSReader : ISpriteSource
{
readonly List<TmpTSTile> tiles = new List<TmpTSTile>();
public IEnumerable<ISpriteFrame> Frames { get { return tiles.Cast<ISpriteFrame>(); } }
readonly List<ISpriteFrame> tiles = new List<ISpriteFrame>();
public IEnumerable<ISpriteFrame> Frames { get { return tiles; } }
public bool CacheWhenLoadingTileset { get { return false; } }
public TmpTSReader(Stream s)