Use hashbrown instead of fxhashmap in world.

This commit is contained in:
Acrimon 2019-08-11 22:10:36 +02:00
parent 22f318833c
commit ed4909670d
4 changed files with 8 additions and 8 deletions

2
Cargo.lock generated
View File

@ -3007,7 +3007,7 @@ dependencies = [
name = "veloren-world"
version = "0.3.0"
dependencies = [
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
"hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"minifb 0.12.0 (git+https://github.com/emoon/rust_minifb.git)",
"noise 0.5.1 (registry+https://github.com/rust-lang/crates.io-index)",

View File

@ -8,7 +8,7 @@ edition = "2018"
common = { package = "veloren-common", path = "../common" }
vek = "0.9.8"
noise = "0.5.1"
fxhash = "0.2.1"
hashbrown = "0.5.0"
lazy_static = "1.3.0"
rand = "0.7.0"
rand_chacha = "0.2.1"

View File

@ -1,5 +1,5 @@
use super::Settlement;
use fxhash::FxHashSet;
use hashbrown::HashSet;
use rand::seq::SliceRandom;
use rand::Rng;
use vek::*;
@ -9,7 +9,7 @@ pub struct Location {
pub(crate) name: String,
pub(crate) center: Vec2<i32>,
pub(crate) kingdom: Option<Kingdom>,
pub(crate) neighbours: FxHashSet<usize>,
pub(crate) neighbours: HashSet<usize>,
pub(crate) settlement: Settlement,
}
@ -19,7 +19,7 @@ impl Location {
name: generate_name(rng),
center,
kingdom: None,
neighbours: FxHashSet::default(),
neighbours: HashSet::default(),
settlement: Settlement::generate(rng),
}
}

View File

@ -1,9 +1,9 @@
use fxhash::FxHashMap;
use hashbrown::HashMap;
use std::hash::Hash;
pub struct HashCache<K: Hash + Eq + Clone, V> {
capacity: usize,
map: FxHashMap<K, (usize, V)>,
map: HashMap<K, (usize, V)>,
counter: usize,
}
@ -17,7 +17,7 @@ impl<K: Hash + Eq + Clone, V> HashCache<K, V> {
pub fn with_capacity(capacity: usize) -> Self {
Self {
capacity,
map: FxHashMap::default(),
map: HashMap::default(),
counter: 0,
}
}