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/lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'ecs/src/lib.rs') diff --git a/ecs/src/lib.rs b/ecs/src/lib.rs index 3926344..43a00f1 100644 --- a/ecs/src/lib.rs +++ b/ecs/src/lib.rs @@ -2,12 +2,13 @@ use std::any::{type_name, TypeId}; use std::cell::RefCell; -use std::collections::HashMap; use std::fmt::Debug; use std::mem::ManuallyDrop; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; +use hashbrown::HashMap; + use crate::actions::Action; use crate::component::storage::Storage as ComponentStorage; use crate::component::{ -- cgit v1.2.3-18-g5258