From 36bfd4159cb1bd8b3d47a834824465728dfb5bd8 Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 20 Dec 2024 20:19:12 +0100 Subject: perf(ecs): use component index map when creating component sequences --- ecs/src/component/storage.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'ecs/src/component/storage.rs') 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 { self.component_ids.get(&component_id).copied() -- cgit v1.2.3-18-g5258