-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Avoid making unnecessary copies of the displayable state #3
Comments
This might require more thinking than anticipated. In addition to the things to account for that are mentioned above, to tween, we need to keep a copy of the previous state. The above suggestion moves the responsibility to keep this copy from CrystalOrb to the downstream World implementation, which is not ideal:
At least, in theory, we could shrink down the number of copies of the entire world state from 6 copies down to maybe 3 copies:
However, the number of copies needed might grow further when we take into account #4 |
Since this might add a fair bit of complexity / refactoring to the codebase, we should definitely set up benchmarking first before blindly optimizing things. For example, one could make the following argument: If a game's For now, it is probably wise to put a warning in the README that CrystalOrb may not scale well to larger games. |
This repo started out as a simple state syncing implementation, and to make things easier to implement and more generalisable, the design did not focus on memory footprint and the performance penalties due to unnecessary copying of data.
For example, the client code results in having roughly 6 copies of the entire simulation state at any time! This is due to needing:
On discord, @TheRawMeetball suggested something like the following to be added to the
World
trait, in place of theDisplayState
trait.We could similarly extend this concept to allow for "blending" between the old and new worlds. Things to account for:
DisplayState
can currently be composed together in different ways to support different kinds of synchronization strategies. Do we still want some kind of composability?To verify the changes and explore new designs, it might be good to first setup some benchmarking.
The text was updated successfully, but these errors were encountered: