Improve loading performance for loader/compression classes.

- In RLEZerosCompression use dedicated Array.Clear method instead of open-coded loop.
- In VoxelLoader.GenerateSlicePlanes.Get use TryGetValue to avoid repeated array and dictionary lookups.
- In TmpTSLoader.UnpackTileData use ReadBytes to populate array with less overhead compared to repeated one byte reads.
- Resolve TODO in VqaVideo.
This commit is contained in:
RoosterDragon
2023-06-28 18:47:23 +01:00
committed by Gustas
parent dccb3ce9ce
commit 1c0885c636
4 changed files with 12 additions and 81 deletions

View File

@@ -120,8 +120,7 @@ namespace OpenRA.Mods.Cnc.SpriteLoaders
for (var j = 0; j < size.Height; j++)
{
var start = (j - frameBounds.Y) * frameBounds.Width + (size.Width - width) / 2 - frameBounds.X;
for (var i = 0; i < width; i++)
data[start + i] = s.ReadUInt8();
s.ReadBytes(data, start, width);
width += (j < size.Height / 2 - 1 ? 1 : -1) * 4;
}