RobustToolbox icon indicating copy to clipboard operation
RobustToolbox copied to clipboard

Perf: Avoid a copy of ComponentChanges every tick within Checkpoints

Open tom-leys opened this issue 9 months ago • 0 comments

  • 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): image

After: image

After using ApplyToFullState: image

I tested using this replay: https://moon.spacestation14.com/replays/lizard/2024/05/18/lizard-2024_05_18-16_22-round_53948.zip

tom-leys avatar May 18 '24 22:05 tom-leys