Anders429 / Anders429/brood

Store zero-sized components separately

Đang mở
#174 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
A - Storage C - Enhancement C - Performance P - Low S - Needs Investigation
Ngôn ngữ chính
Rust
Star
41
Fork
2
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

ZSTs that are components, commonly called "marker" components or "tag" components, may not actually warrant inclusion in the archetype identifier. They are not actually stored, and are just used to mark something about an entity.

I wonder if there is a better solution, using some separate storage for what ZSTs are applied to each entity within an archetype. This way, we don't have to reallocate and move the entire entity when changing what ZSTs are applied to the entity.

We can use some kind of trait extension on `Component`, adding a `IS_ZST` associated constant to the component. Then this can be used to branch when storing or modifying an entity. The sized components will be stored as normal, but the ZST components will be stored in some kind of set, mapping which entity identifiers they are associated with. Care will need to be taken in designing this feature, to ensure it doesn't slow down storage or iterating.

The advantage gained here should be an increase in performance when adding or removing ZSTs from an entity. It will save reallocation and the expensive moving of an entire entity to another archetype.

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.