Use CollectionsMarshal to hold a ref to the dictionary entry. When the value needs to be added this allows us to set the value directly into it without having to locate the entry a second time.
- Seal the classes, and make SourceLocation a readonly struct.
- In ToDictionary, use TryAdd to avoid a try-catch.
- In Merge, use ToList to ensure sources is only enumerated once.
Moving the key duplication check allows a redundant check on top-level nodes to be avoided. Add tests to ensure key checks are functioning as expected.
- In FieldLoader, cache boxed bools and some boxed ints.
- In FieldLoader, presize collections when parsing a List, HashSet or Dictionary.
- In FieldLoader, don't allocate a list of missing items until required.
- In FieldLoader, when a string value is passed, avoid wrapping this in a MiniYaml object by allowing both strings and yaml to be passed in the GetValue overload that does the real work.
- In Animation, avoid allocating no-op actions.
- In VxlReader, use EnsureCapcity to better size the Dictionary.
- In VxlReader change VxlElement to a struct.
- In Locomotor, presize TerrainSpeeds dictionary.
- In MixFile, the Distinct call doesn't presize the HashSet it uses internally. As we know we will enumerate all results, create the HashSet ourselves so that is it presized correctly.
- In ObjectCreator, stream the assembly when hashing rather than reading all bytes into memory.
These changes avoid some allocations on the large object heap, in turn this means the GC can avoid performing unnecessary Gen 2 collections just to clear down the LOH.
- 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.
Provides two callbacks using INotifyMineLaying interface: MineLaying (just before laying a mine), MineLaid after mine actor has been created (in FrameEndTask)
Apparently building/publishing/packaging for Windows on Linux using .NET 6 sets some of the assembly / Portable Executable information for the generated DLL, but nothing for the generated EXE (which isn't the case when building on Windows).
Reduces size used for oramap files from 2,774,405 bytes to 2,614,332 bytes in total. The smaller files also improve loading times as the zlib decoder has less bytes to schlep through.
The PNG decoder shipped with OpenRA only supports a bit depth of 8 for images with a palette, so must must ensure that other depths (1,2 or 4) are not used.
zopfilpng is used for compression with the following command line:
'zopflipng.exe --keepcolortype -y -m image.png image.png'
The keepcolortype flag ensures the bit depth is not changed.
The oramap files were updated by:
- Saving as a folder, unpacking the data in loose files.
- Compressing the png files using the command above.
- Saving back as an oramap, except instead of regenerating the map preview on save we save the existing version on disk.
Reduces size used for png files from 19,034,446 bytes to 13,305,798 bytes in total. The smaller files also improve loading times as the zlib decoder has less bytes to schlep through.
The PNG decoder shipped with OpenRA only supports a bit depth of 8 for images with a palette, so must must ensure that other depths (1,2 or 4) are not used.
zopfilpng is used for compression with the following command line:
'zopflipng.exe --keepcolortype -y -m image.png image.png'
The keepcolortype flag ensures the bit depth is not changed.
Most cells are accessible, so presizing to the full size of the grid is sensible to avoid allocations to resize as it is filled up. The set can also be reused across all layers to avoid allocating it many times.