That sounds quite neat
That sounds quite neat
How does that square with performance? To implement transactions there has to be a copy of whatever state is manipulated by the transaction. That is potentially a huge amount of state that has to be copied.
The less you mutate, the more you can reuse without copying.
I really wonder whether people making claims that "something would be slow for games" actually bother benchmarking if that's true and how much.
The fact that something might be faster theoretically isn't really relevant if the calculations stay on a very small scale.
I know for example that EnTT, a C++ ECS project has snapshots available to allow you to save the game state in the background without blocking gameplay as an example.
This persistent data is what you use transactions on, and there are past experiments of doing things like fully double-buffering this state (Each frame, recreate the full state into a different buffer, with the code doing so only touching the previous frame, never reading from the current one. Great for multi-threading!)