RobustToolbox
RobustToolbox copied to clipboard
Perf: Avoid a copy of ComponentChanges every tick within Checkpoints
- Also remove temporary Dictionary created every tick * every change
- Reduces GC load, 8GB less temporary allocations on large replays.
- Makes processing step over 2x as fast on my system (though I am testing that with a memory profiler running)
- Use delta.ApplyToFullState when possible avoiding 1GB of temporaries for Gas tiles for instance.
Related to https://github.com/space-wizards/space-station-14/issues/28052 though this PR reduces memory thrashing rather than final memory usage.
Before (showing allocations during processing replay step):
After:
After using ApplyToFullState:
I tested using this replay: https://moon.spacestation14.com/replays/lizard/2024/05/18/lizard-2024_05_18-16_22-round_53948.zip