From be7d20f0c57cc834e943426090fe2debf76ca98d Mon Sep 17 00:00:00 2001 From: HampusM Date: Fri, 20 Dec 2024 21:27:48 +0100 Subject: perf(ecs): use hashbrown's HashMap & HashSet Hashbrown's HashMap & HashSet is faster than std's. I guess this is because std (which uses hashbrown) does not enable hashbrown's default-hasher flag and instead uses a slower hasher. --- ecs/src/component/storage.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ecs/src/component/storage.rs') diff --git a/ecs/src/component/storage.rs b/ecs/src/component/storage.rs index 54fa834..dcf0181 100644 --- a/ecs/src/component/storage.rs +++ b/ecs/src/component/storage.rs @@ -1,10 +1,11 @@ use std::any::type_name; use std::borrow::Borrow; use std::cell::RefCell; -use std::collections::{HashMap, HashSet}; use std::slice::Iter as SliceIter; use std::vec::IntoIter as OwnedVecIter; +use hashbrown::{HashMap, HashSet}; + use crate::archetype::Id as ArchetypeId; use crate::component::{ Component, -- cgit v1.2.3-18-g5258