Skip to content

Commit 54742c6

Browse files
authored
perf: switch to hashbrown hashmap in the function registry (#399)
# Summary The function registry as well as the allocator used the standard `std` hashmap, which by default uses a secure but slow hash. We don't need to worry about security here, so switching to hashbrown should give us a fair bit of speed up for free.
1 parent 5ebabbf commit 54742c6

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

crates/bevy_mod_scripting_core/src/bindings/allocator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ use bevy::{
66
ecs::system::{Res, Resource},
77
prelude::ResMut,
88
reflect::PartialReflect,
9+
utils::hashbrown::HashMap,
910
};
1011
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
1112
use std::{
1213
cell::UnsafeCell,
1314
cmp::Ordering,
14-
collections::HashMap,
1515
fmt::{Display, Formatter},
1616
hash::Hasher,
1717
sync::{atomic::AtomicU64, Arc},

crates/bevy_mod_scripting_core/src/bindings/function/script_function.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ use crate::{
1111
ScriptValue,
1212
};
1313
use bevy::prelude::{Reflect, Resource};
14+
use bevy::utils::hashbrown::HashMap;
1415
use parking_lot::{RwLock, RwLockReadGuard, RwLockWriteGuard};
1516
use std::borrow::Cow;
16-
use std::collections::{HashMap, VecDeque};
17+
use std::collections::VecDeque;
1718
use std::hash::Hash;
1819
use std::ops::{Deref, DerefMut};
1920
use std::sync::Arc;

0 commit comments

Comments
 (0)