summaryrefslogtreecommitdiff
path: root/ecs/src/component
diff options
context:
space:
mode:
authorHampusM <hampus@hampusmat.com>2024-12-20 20:19:12 +0100
committerHampusM <hampus@hampusmat.com>2024-12-20 21:33:13 +0100
commit36bfd4159cb1bd8b3d47a834824465728dfb5bd8 (patch)
tree89efb158591ffacce09e72b2a0e02208e12f31b9 /ecs/src/component
parentbe7d20f0c57cc834e943426090fe2debf76ca98d (diff)
perf(ecs): use component index map when creating component sequences
Diffstat (limited to 'ecs/src/component')
-rw-r--r--ecs/src/component/storage.rs5
1 files changed, 5 insertions, 0 deletions
diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs
index dcf0181..b46d053 100644
--- a/ecs/src/component/storage.rs
+++ b/ecs/src/component/storage.rs
@@ -414,6 +414,11 @@ impl Archetype
EntityIter { iter: self.entities.iter() }
}
+ pub fn entity_cnt(&self) -> usize
+ {
+ self.entities.len()
+ }
+
pub fn get_index_for_component(&self, component_id: Uid) -> Option<usize>
{
self.component_ids.get(&component_id).copied()