UnityTimeRewinder icon indicating copy to clipboard operation
UnityTimeRewinder copied to clipboard

delta encoding / run-length to reduce memory footprint

Open demolen opened this issue 1 year ago • 3 comments

Would it be feasable to think of implementing delta encoding or run-length encoding in the circular buffer to compress the data?

demolen avatar May 08 '24 15:05 demolen

maybe using GZipStream or DeflateStream.?

demolen avatar May 08 '24 15:05 demolen

Hello @demolen I honestly dont know if it is even possible to use such algorithms, since data are constantly written to circular buffer. It is continuous stream and I would guess these compression algorithms would work best if they were applied on the whole data/stream (finding similarities, compressing them etc...).

But it would probably make sense to implement some compression algorithm manually, where for example you would track same values and store pointers on the same values (since this is very common state here). But I personally didnt have the need to implement something like this, as even on mobiles the memory usage was fine without compression.

I dont have such plans of implementing this. However if you manage to find something that works well and doesnt break general functionality of circular buffer, I am open to accept pull request :)

SitronX avatar May 22 '24 16:05 SitronX

I actually did manage to implement DeflateStream in your code. I could send you the implementation once I find time. However, i switched from unity to Godot and life is so much better now. :)

demolen avatar May 22 '24 18:05 demolen