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:
@@ -108,10 +108,10 @@ namespace OpenRA.Mods.Cnc.Graphics
|
||||
return null;
|
||||
|
||||
var v = l.VoxelMap[(byte)x, (byte)y];
|
||||
if (v == null || !v.ContainsKey((byte)z))
|
||||
if (v == null || !v.TryGetValue((byte)z, out var element))
|
||||
return null;
|
||||
|
||||
return l.VoxelMap[(byte)x, (byte)y][(byte)z];
|
||||
return element;
|
||||
}
|
||||
|
||||
// Cull slices without any visible faces
|
||||
|
||||
Reference in New Issue
Block a user