Skip to content

Commit

Permalink
use hashbrown
Browse files Browse the repository at this point in the history
  • Loading branch information
jupyterkat committed Jul 22, 2023
1 parent 4feb284 commit 3a70319
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 5 deletions.
11 changes: 11 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[features]
default = ["auxcleanup_gas_deletion", "turf_processing", "katmos"]
default = ["auxcleanup_gas_deletion", "turf_processing"]
auxcleanup_gas_deletion = ["auxcleanup"]
zas_hooks = []
turf_processing = []
Expand Down Expand Up @@ -44,6 +44,7 @@ ahash = "0.8.3"
lazy_static = "1.4.0"
indexmap = { version = "2.0.0", features = ["rayon"] }
dashmap = { version = "5.5.0", features = ["rayon"] }
hashbrown = "0.14.0"
atomic_float = "0.1.0"
petgraph = "0.6.3"
bitflags = "2.3.3"
Expand Down
4 changes: 3 additions & 1 deletion src/gas/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ use dashmap::DashMap;

use std::{
cell::RefCell,
collections::{BTreeMap, HashMap},
collections::BTreeMap,
sync::atomic::{AtomicUsize, Ordering},
};

use hashbrown::HashMap;

static TOTAL_NUM_GASES: AtomicUsize = AtomicUsize::new(0);

static REACTION_INFO: RwLock<Option<BTreeMap<ReactionPriority, Reaction>>> = const_rwlock(None);
Expand Down
2 changes: 1 addition & 1 deletion src/reaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub struct Reaction {
}

use fxhash::FxBuildHasher;
use std::collections::HashMap;
use hashbrown::HashMap;

enum ReactionSide {
ByondSide(Value),
Expand Down
2 changes: 1 addition & 1 deletion src/reaction/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ fn fusion(byond_air: &Value, holder: &Value) -> DMResult<Value> {
#[cfg(feature = "generic_fire_hook")]
fn generic_fire(byond_air: &Value, holder: &Value) -> DMResult<Value> {
use fxhash::FxBuildHasher;
use std::collections::HashMap;
use hashbrown::HashMap;
let mut burn_results: HashMap<GasIDX, f32, FxBuildHasher> = HashMap::with_capacity_and_hasher(
super::total_num_gases() as usize,
FxBuildHasher::default(),
Expand Down
4 changes: 3 additions & 1 deletion src/turfs/katmos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ use coarsetime::{Duration, Instant};
use std::{
cell::Cell,
{
collections::{BTreeSet, HashMap, HashSet},
collections::BTreeSet,
sync::atomic::{AtomicUsize, Ordering},
},
};

use hashbrown::{HashMap, HashSet};

use parking_lot::{const_mutex, Mutex};

static EQUALIZE_CHANNEL: Mutex<Option<BTreeSet<TurfID>>> = const_mutex(None);
Expand Down

0 comments on commit 3a70319

Please sign in to comment.