unity-experiment-framework icon indicating copy to clipboard operation
unity-experiment-framework copied to clipboard

Lag spikes from Trial.SaveData with large tracker files

Open soelderer opened this issue 5 months ago • 1 comments

I'm tracking data with 1kHz during trials which adds up easily to >8MB of GC Alloc and causes lag spikes in Trial.SaveDataTable:

Trial.End(): 9.5MB GC Alloc, Time 121ms, Self 4ms
Trial.SaveData: 7.6MB GC Alloc, Time 112ms, Self 0.6ms
Trial.SaveDataTable: 7.6MB GC Alloc, Time 107ms, Self 0.1ms
FileSaver.HandleDataTable: 7.6MB GC Alloc, Time 94ms, Self 0.4ms
UXFDataTable.GetCSVLines 7.6MB GC Alloc, Time 86ms, Self 76ms

Most of which is due to GetCSVLines(), because it allocates thousands of lines.

I suggest to move it to ManageInWorker(). I will try if that's possible and report back. I will also take a look if it's possible to optimize the loops etc.

Best, Paul

soelderer avatar Jul 22 '25 09:07 soelderer