SitronX / UnityTimeRewinder

Unity time rewind solution, that is easily customizable for any project.
MIT License
282 stars 31 forks source link

delta encoding / run-length to reduce memory footprint #6

Open demolen opened 4 months ago

demolen commented 4 months ago

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

demolen commented 4 months ago

maybe using GZipStream or DeflateStream.?

SitronX commented 4 months ago

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

demolen commented 4 months ago

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. :)