Proposal: Refcounted Double Linked Lists for version objects #761
Replies: 3 comments 11 replies
-
Two thoughts come to mind:
Forgive me if I'm missing something obvious. |
Beta Was this translation helpful? Give feedback.
-
Converted the issue to a discussion since it seems better suited. |
Beta Was this translation helpful? Give feedback.
-
I am also interested in more robust handling of the version numbers. I have started a general discussion related to this and proposed another approach here: #875. |
Beta Was this translation helpful? Give feedback.
-
This might not be useful for everyone, but I thought to write it down in case it might have interesting applications
The problem with incremental counters for versions in
Entity
identifiers is that for long-running programs (like, if Entt/ECS is used to implement an online game server), they might wrap around and result in false alive tests.The optimization opportunity is that many version numbers might have no entities pointing to them, and that all the functionality provided by versioning can presumably exist with a reduced set of Version identifiers. The only important invariants for versions is that:
These can be easily achieved by implementing the Version objects as DL lists with a refcount of Entity references. Whenever it is detected that no one holds an Entity reference point to a given Version object, the object is removed.
If one is confident the number of alive versions in a program will remain limited, one might replace a pointer to a version object as the version identifier, with an index in the actual array of pointers
Any feedback on the above is welcome.
Beta Was this translation helpful? Give feedback.
All reactions