HouraiTeahouse / backroll-rs

A (almost) 100% pure safe Rust implementation of GGPO-style rollback netcode.
ISC License
351 stars 18 forks source link

Consider reverting to the C-style ring-buffer for SavedState #13

Closed james7132 closed 3 years ago

james7132 commented 3 years ago

Commit cf0b896c7e56c7916aceb8595fd4cdb04df44ea8 fixed #12 but replaced the SaveState ring buffer with a frame-keyed hashmap instead. This adds the overhead of clearing out the HashMap of old states each time a frame is confirmed by a remote, and potentially allocates more on the heap each time a new state is saved. This indirection is likely not particularly cache friendly.

However, given this HashMap should normally never be more than 8-20 entries large at a given time, this may be a moot point in terms of performance.

Leaving this as an issue to revisit this when time permits.

james7132 commented 3 years ago

Implemented as of 10c5fd8 without reintroducing the desync that caused #12.