diff --git a/Cargo.lock b/Cargo.lock index 5927cc1237..068ce3a238 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1283,6 +1283,9 @@ dependencies = [ name = "hashbrown" version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "serde 1.0.98 (registry+https://github.com/rust-lang/crates.io-index)", +] [[package]] name = "heaptrack" @@ -2912,7 +2915,7 @@ dependencies = [ "bincode 1.1.4 (registry+https://github.com/rust-lang/crates.io-index)", "dot_vox 4.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "find_folder 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", - "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)", "image 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/client/Cargo.toml b/client/Cargo.toml index 1bcc0e1b41..1a105b8e4f 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -12,4 +12,4 @@ num_cpus = "1.10.1" log = "0.4.8" specs = "0.14.2" vek = "0.9.8" -hashbrown = "0.5.0" +hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } diff --git a/common/Cargo.toml b/common/Cargo.toml index 77a64965b6..ed0edf6958 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -23,5 +23,5 @@ rand = "0.7.0" rayon = "1.1.0" lazy_static = "1.3.0" lz4-compress = "0.1.1" -fxhash = "0.2.1" +hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } find_folder = "0.3.0" diff --git a/common/src/assets/mod.rs b/common/src/assets/mod.rs index 29af8eb333..c149a89df8 100644 --- a/common/src/assets/mod.rs +++ b/common/src/assets/mod.rs @@ -1,12 +1,12 @@ //! Load assets (images or voxel data) from files use dot_vox::DotVoxData; +use hashbrown::HashMap; use image::DynamicImage; use lazy_static::lazy_static; use serde_json::Value; use std::{ any::Any, - collections::HashMap, env, fs::{self, read_link, File, ReadDir}, io::{BufReader, Read}, diff --git a/common/src/msg/server.rs b/common/src/msg/server.rs index 8e92e0d2be..6dbf86234c 100644 --- a/common/src/msg/server.rs +++ b/common/src/msg/server.rs @@ -4,7 +4,7 @@ use crate::{ terrain::{Block, TerrainChunk}, ChatType, }; -use fxhash::FxHashMap; +use hashbrown::HashMap; use vek::*; #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] @@ -60,7 +60,7 @@ pub enum ServerMsg { key: Vec2, chunk: Box, }, - TerrainBlockUpdates(FxHashMap, Block>), + TerrainBlockUpdates(HashMap, Block>), Error(ServerError), Disconnect, Shutdown, diff --git a/common/src/state.rs b/common/src/state.rs index 2a19a74da9..7c38442b2f 100644 --- a/common/src/state.rs +++ b/common/src/state.rs @@ -9,7 +9,7 @@ use crate::{ terrain::{Block, TerrainChunk, TerrainMap}, vol::WriteVol, }; -use fxhash::{FxHashMap, FxHashSet}; +use hashbrown::{HashMap, HashSet}; use rayon::{ThreadPool, ThreadPoolBuilder}; use serde_derive::{Deserialize, Serialize}; use specs::{ @@ -45,7 +45,7 @@ const MAX_DELTA_TIME: f32 = 1.0; #[derive(Default)] pub struct BlockChange { - blocks: FxHashMap, Block>, + blocks: HashMap, Block>, } impl BlockChange { @@ -60,10 +60,10 @@ impl BlockChange { #[derive(Default)] pub struct TerrainChanges { - pub new_chunks: FxHashSet>, - pub modified_chunks: FxHashSet>, - pub removed_chunks: FxHashSet>, - pub modified_blocks: FxHashMap, Block>, + pub new_chunks: HashSet>, + pub modified_chunks: HashSet>, + pub removed_chunks: HashSet>, + pub modified_blocks: HashMap, Block>, } impl TerrainChanges { diff --git a/common/src/terrain/chonk.rs b/common/src/terrain/chonk.rs index a00f44a1f9..42541166e2 100644 --- a/common/src/terrain/chonk.rs +++ b/common/src/terrain/chonk.rs @@ -3,7 +3,7 @@ use crate::{ vol::{BaseVol, ReadVol, VolSize, WriteVol}, volumes::chunk::{Chunk, ChunkErr}, }; -use fxhash::FxHashMap; +use hashbrown::HashMap; use serde_derive::{Deserialize, Serialize}; use std::ops::Add; use vek::*; @@ -179,7 +179,7 @@ impl WriteVol for Chonk { // Can't fail SubChunk::Homogeneous(cblock) if block == *cblock => Ok(()), SubChunk::Homogeneous(cblock) => { - let mut map = FxHashMap::default(); + let mut map = HashMap::default(); map.insert(rpos.map(|e| e as u8), block); self.sub_chunks[sub_chunk_idx] = SubChunk::Hash(*cblock, map); @@ -238,7 +238,7 @@ impl VolSize for SubChunkSize { #[derive(Debug, Clone, Serialize, Deserialize)] pub enum SubChunk { Homogeneous(Block), - Hash(Block, FxHashMap, Block>), + Hash(Block, HashMap, Block>), Heterogeneous(Chunk), } diff --git a/common/src/volumes/vol_map_2d.rs b/common/src/volumes/vol_map_2d.rs index 28b29fdcbb..b3ba4d3d9d 100644 --- a/common/src/volumes/vol_map_2d.rs +++ b/common/src/volumes/vol_map_2d.rs @@ -2,8 +2,8 @@ use crate::{ vol::{BaseVol, ReadVol, SampleVol, VolSize, WriteVol}, volumes::dyna::DynaErr, }; -use fxhash::FxHashMap; -use std::{collections::hash_map, fmt::Debug, marker::PhantomData, sync::Arc}; +use hashbrown::{hash_map, HashMap}; +use std::{fmt::Debug, marker::PhantomData, sync::Arc}; use vek::*; #[derive(Debug, Clone)] @@ -19,7 +19,7 @@ pub enum VolMap2dErr { // M = Chunk metadata #[derive(Clone)] pub struct VolMap2d { - chunks: FxHashMap, Arc>, + chunks: HashMap, Arc>, phantom: PhantomData, } @@ -122,7 +122,7 @@ impl VolMap2d { .reduce_and() { Ok(Self { - chunks: FxHashMap::default(), + chunks: HashMap::default(), phantom: PhantomData, }) } else { @@ -177,7 +177,7 @@ impl VolMap2d { } pub struct ChunkIter<'a, V: BaseVol> { - iter: std::collections::hash_map::Iter<'a, Vec2, Arc>, + iter: hash_map::Iter<'a, Vec2, Arc>, } impl<'a, V: BaseVol> Iterator for ChunkIter<'a, V> { diff --git a/common/src/volumes/vol_map_3d.rs b/common/src/volumes/vol_map_3d.rs index ad3bc42b9c..b1105d8cb7 100644 --- a/common/src/volumes/vol_map_3d.rs +++ b/common/src/volumes/vol_map_3d.rs @@ -2,7 +2,8 @@ use crate::{ vol::{BaseVol, ReadVol, SampleVol, VolSize, WriteVol}, volumes::dyna::DynaErr, }; -use std::{collections::HashMap, fmt::Debug, marker::PhantomData, sync::Arc}; +use hashbrown::{hash_map, HashMap}; +use std::{fmt::Debug, marker::PhantomData, sync::Arc}; use vek::*; #[derive(Debug)] @@ -161,7 +162,7 @@ impl VolMap3d { } pub struct ChunkIter<'a, V: BaseVol> { - iter: std::collections::hash_map::Iter<'a, Vec3, Arc>, + iter: hash_map::Iter<'a, Vec3, Arc>, } impl<'a, V: BaseVol> Iterator for ChunkIter<'a, V> { diff --git a/server/Cargo.toml b/server/Cargo.toml index 17e2a5cd79..c9dbb40257 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -19,4 +19,4 @@ serde = "1.0.98" serde_derive = "1.0.98" rand = "0.7.0" chrono = "0.4.7" -hashbrown = "0.5.0" +hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } diff --git a/voxygen/Cargo.toml b/voxygen/Cargo.toml index b1df18646c..bf52ab9d35 100644 --- a/voxygen/Cargo.toml +++ b/voxygen/Cargo.toml @@ -57,4 +57,4 @@ frustum_query = "0.1.2" rodio = { git = "https://github.com/desttinghim/rodio.git", rev = "dd93f905c1afefaac03c496a666ecab27d3e391b" } crossbeam = "0.7.2" heaptrack = "0.3.0" -hashbrown = "0.5.0" +hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } diff --git a/world/Cargo.toml b/world/Cargo.toml index 7d2bef9fc4..4b86cfb732 100644 --- a/world/Cargo.toml +++ b/world/Cargo.toml @@ -8,7 +8,7 @@ edition = "2018" common = { package = "veloren-common", path = "../common" } vek = "0.9.8" noise = "0.5.1" -hashbrown = "0.5.0" +hashbrown = { version = "0.5.0", features = ["serde", "nightly"] } lazy_static = "1.3.0" rand = "0.7.0" rand_chacha = "0.2.1"