Updated hashbrown, removed some to_owned calls in handling recently unequipped items

This commit is contained in:
Sam 2023-04-16 19:39:02 -04:00
parent 63bf8f3ac7
commit e819cd2309
17 changed files with 42 additions and 29 deletions

33
Cargo.lock generated
View File

@ -2685,6 +2685,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888"
dependencies = [ dependencies = [
"ahash 0.7.6", "ahash 0.7.6",
]
[[package]]
name = "hashbrown"
version = "0.13.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e"
dependencies = [
"ahash 0.8.0",
"rayon", "rayon",
"serde", "serde",
] ]
@ -6651,7 +6660,7 @@ dependencies = [
"authc", "authc",
"byteorder", "byteorder",
"clap 3.2.22", "clap 3.2.22",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"image", "image",
"num 0.4.0", "num 0.4.0",
"quinn", "quinn",
@ -6686,7 +6695,7 @@ dependencies = [
"fluent", "fluent",
"fluent-bundle", "fluent-bundle",
"fluent-syntax", "fluent-syntax",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"intl-memoizer", "intl-memoizer",
"ron 0.8.0", "ron 0.8.0",
"serde", "serde",
@ -6713,7 +6722,7 @@ dependencies = [
"dot_vox", "dot_vox",
"enum-map", "enum-map",
"fxhash", "fxhash",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"indexmap", "indexmap",
"itertools", "itertools",
"kiddo 0.1.7", "kiddo 0.1.7",
@ -6808,7 +6817,7 @@ version = "0.10.0"
dependencies = [ dependencies = [
"bincode", "bincode",
"flate2", "flate2",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"image", "image",
"num-traits", "num-traits",
"serde", "serde",
@ -6824,7 +6833,7 @@ name = "veloren-common-state"
version = "0.10.0" version = "0.10.0"
dependencies = [ dependencies = [
"bincode", "bincode",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"num_cpus", "num_cpus",
"rayon", "rayon",
"scopeguard", "scopeguard",
@ -6847,7 +6856,7 @@ dependencies = [
name = "veloren-common-systems" name = "veloren-common-systems"
version = "0.10.0" version = "0.10.0"
dependencies = [ dependencies = [
"hashbrown 0.12.3", "hashbrown 0.13.2",
"indexmap", "indexmap",
"itertools", "itertools",
"ordered-float 3.1.0", "ordered-float 3.1.0",
@ -6878,7 +6887,7 @@ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"futures-core", "futures-core",
"futures-util", "futures-util",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"lazy_static", "lazy_static",
"lz-fear", "lz-fear",
"prometheus", "prometheus",
@ -6906,7 +6915,7 @@ dependencies = [
"bitflags", "bitflags",
"bytes", "bytes",
"criterion", "criterion",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"prometheus", "prometheus",
"rand 0.8.5", "rand 0.8.5",
"tokio", "tokio",
@ -6949,7 +6958,7 @@ dependencies = [
"atomic_refcell", "atomic_refcell",
"enum-map", "enum-map",
"fxhash", "fxhash",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"itertools", "itertools",
"rand 0.8.5", "rand 0.8.5",
"rand_chacha 0.3.1", "rand_chacha 0.3.1",
@ -6979,7 +6988,7 @@ dependencies = [
"enum-map", "enum-map",
"enumset", "enumset",
"futures-util", "futures-util",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"humantime", "humantime",
"itertools", "itertools",
"lazy_static", "lazy_static",
@ -7095,7 +7104,7 @@ dependencies = [
"gilrs", "gilrs",
"glyph_brush", "glyph_brush",
"guillotiere", "guillotiere",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"iced_native", "iced_native",
"iced_winit", "iced_winit",
"image", "image",
@ -7195,7 +7204,7 @@ dependencies = [
"fallible-iterator", "fallible-iterator",
"flate2", "flate2",
"fxhash", "fxhash",
"hashbrown 0.12.3", "hashbrown 0.13.2",
"image", "image",
"inline_tweak", "inline_tweak",
"itertools", "itertools",

View File

@ -30,7 +30,7 @@ tracing = { version = "0.1", default-features = false }
rayon = "1.5" rayon = "1.5"
specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] } specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] }
vek = { version = "0.15.8", features = ["serde"] } vek = { version = "0.15.8", features = ["serde"] }
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" } authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" }
#TODO: put bot in a different crate #TODO: put bot in a different crate

View File

@ -17,7 +17,7 @@ intl-memoizer = { git = "https://github.com/juliancoffee/fluent-rs.git", branch
fluent = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"} fluent = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"}
fluent-bundle = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"} fluent-bundle = { git = "https://github.com/juliancoffee/fluent-rs.git", branch = "patched"}
# Utility # Utility
hashbrown = { version = "0.12", features = ["serde", "nightly"] } hashbrown = { version = "0.13", features = ["serde", "nightly"] }
deunicode = "1.0" deunicode = "1.0"
tracing = "0.1" tracing = "0.1"
# Bin # Bin

View File

@ -74,7 +74,7 @@ petgraph = { version = "0.6", optional = true }
kiddo = { version = "0.1", optional = true } kiddo = { version = "0.1", optional = true }
# Data structures # Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
slotmap = { version = "1.0", features = ["serde"] } slotmap = { version = "1.0", features = ["serde"] }
indexmap = { version = "1.3.0", features = ["rayon"] } indexmap = { version = "1.3.0", features = ["rayon"] }
slab = "0.4.2" slab = "0.4.2"

View File

@ -22,7 +22,7 @@ vek = { version = "0.15.8", features = ["serde"] }
tracing = { version = "0.1", default-features = false } tracing = { version = "0.1", default-features = false }
# Data structures # Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
# ECS # ECS
specs = { version = "0.18", features = ["serde", "storage-event-control"] } specs = { version = "0.18", features = ["serde", "storage-event-control"] }

View File

@ -20,6 +20,7 @@ use core::{
num::{NonZeroU32, NonZeroU64}, num::{NonZeroU32, NonZeroU64},
}; };
use crossbeam_utils::atomic::AtomicCell; use crossbeam_utils::atomic::AtomicCell;
use hashbrown::Equivalent;
use serde::{de, Deserialize, Serialize, Serializer}; use serde::{de, Deserialize, Serialize, Serializer};
use specs::{Component, DenseVecStorage, DerefFlaggedStorage}; use specs::{Component, DenseVecStorage, DerefFlaggedStorage};
use std::{borrow::Cow, collections::hash_map::DefaultHasher, fmt, sync::Arc}; use std::{borrow::Cow, collections::hash_map::DefaultHasher, fmt, sync::Arc};
@ -1451,6 +1452,10 @@ impl PartialEq<ItemDefinitionIdOwned> for ItemDefinitionId<'_> {
fn eq(&self, other: &ItemDefinitionIdOwned) -> bool { other == self } fn eq(&self, other: &ItemDefinitionIdOwned) -> bool { other == self }
} }
impl Equivalent<ItemDefinitionIdOwned> for ItemDefinitionId<'_> {
fn equivalent(&self, key: &ItemDefinitionIdOwned) -> bool { self == key }
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use super::*; use super::*;

View File

@ -107,9 +107,8 @@ impl Loadout {
time: Time, time: Time,
) -> Option<Item> { ) -> Option<Item> {
if let Some(item_def_id) = item.as_ref().map(|item| item.item_definition_id()) { if let Some(item_def_id) = item.as_ref().map(|item| item.item_definition_id()) {
if let Some((_unequip_time, count)) = self if let Some((_unequip_time, count)) =
.recently_unequipped_items self.recently_unequipped_items.get_mut(&item_def_id)
.get_mut(&item_def_id.to_owned())
{ {
*count = count.saturating_sub(1); *count = count.saturating_sub(1);
} }

View File

@ -910,7 +910,7 @@ impl Inventory {
&& self && self
.loadout .loadout
.recently_unequipped_items .recently_unequipped_items
.contains_key(&item.item_definition_id().to_owned()) .contains_key(&item.item_definition_id())
}) })
}) })
.map(|(slot, _item)| slot) .map(|(slot, _item)| slot)

View File

@ -22,7 +22,7 @@ tracing = { version = "0.1", default-features = false }
vek = { version = "0.15.8", features = ["serde"] } vek = { version = "0.15.8", features = ["serde"] }
# Data structures # Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
# ECS # ECS
specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] } specs = { version = "0.18", features = ["serde", "storage-event-control", "derive"] }

View File

@ -23,7 +23,7 @@ ordered-float = { version = "3", default-features = false }
itertools = "0.10" itertools = "0.10"
# Data structures # Data structures
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
indexmap = "1.3.0" indexmap = "1.3.0"
slab = "0.4.2" slab = "0.4.2"

View File

@ -46,7 +46,7 @@ lz-fear = { version = "0.1.1", optional = true }
async-trait = "0.1.42" async-trait = "0.1.42"
bytes = "^1" bytes = "^1"
# faster HashMaps # faster HashMaps
hashbrown = { version = ">=0.9, <0.13" } hashbrown = { version = "0.13" }
[dev-dependencies] [dev-dependencies]
tracing-subscriber = { version = "0.3.7", default-features = false, features = ["env-filter", "fmt", "time", "ansi", "smallvec"] } tracing-subscriber = { version = "0.3.7", default-features = false, features = ["env-filter", "fmt", "time", "ansi", "smallvec"] }

View File

@ -24,7 +24,7 @@ rand = { version = "0.8" }
# async traits # async traits
async-trait = "0.1.42" async-trait = "0.1.42"
bytes = "^1" bytes = "^1"
hashbrown = { version = ">=0.12, <0.13" } hashbrown = { version = "0.13" }
[dev-dependencies] [dev-dependencies]
async-channel = "1.5.1" async-channel = "1.5.1"

View File

@ -8,7 +8,7 @@ common = { package = "veloren-common", path = "../common" }
world = { package = "veloren-world", path = "../world" } world = { package = "veloren-world", path = "../world" }
ron = "0.8" ron = "0.8"
serde = { version = "1.0.110", features = ["derive"] } serde = { version = "1.0.110", features = ["derive"] }
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
enum-map = { version = "2.4", features = ["serde"] } enum-map = { version = "2.4", features = ["serde"] }
vek = { version = "0.15.8", features = ["serde"] } vek = { version = "0.15.8", features = ["serde"] }
rmp-serde = "1.1.0" rmp-serde = "1.1.0"

View File

@ -54,7 +54,7 @@ ron = { version = "0.8", default-features = false }
serde = { version = "1.0.110", features = ["derive"] } serde = { version = "1.0.110", features = ["derive"] }
serde_json = "1.0.50" serde_json = "1.0.50"
rand = { version = "0.8", features = ["small_rng"] } rand = { version = "0.8", features = ["small_rng"] }
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
parking_lot = { version = "0.12" } parking_lot = { version = "0.12" }
rayon = "1.5" rayon = "1.5"
crossbeam-channel = "0.5" crossbeam-channel = "0.5"

View File

@ -114,7 +114,7 @@ dot_vox = "5.1"
enum-iterator = "1.1.0" enum-iterator = "1.1.0"
guillotiere = "0.6.2" guillotiere = "0.6.2"
etagere = "0.2.7" etagere = "0.2.7"
hashbrown = {version = "0.12", features = ["rayon", "serde", "nightly"]} hashbrown = {version = "0.13", features = ["rayon", "serde", "nightly"]}
image = {version = "0.24", default-features = false, features = ["ico", "png"]} image = {version = "0.24", default-features = false, features = ["ico", "png"]}
lazy_static = "1.4.0" lazy_static = "1.4.0"
native-dialog = { version = "0.6.3", optional = true } native-dialog = { version = "0.6.3", optional = true }

View File

@ -194,7 +194,7 @@ impl<'a> Widget for Group<'a> {
} }
// Helper // Helper
let uid_to_name_text = |uid, client: &Client| match client.player_list().get(&uid) { let uid_to_name_text = |uid: Uid, client: &Client| match client.player_list().get(&uid) {
Some(player_info) => player_info Some(player_info) => player_info
.character .character
.as_ref() .as_ref()

View File

@ -29,7 +29,7 @@ vek = { version = "0.15.8", features = ["serde"] }
noise = { version = "0.7", default-features = false } noise = { version = "0.7", default-features = false }
num = "0.4" num = "0.4"
ordered-float = "3" ordered-float = "3"
hashbrown = { version = "0.12", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.13", features = ["rayon", "serde", "nightly"] }
lazy_static = "1.4.0" lazy_static = "1.4.0"
tracing = { version = "0.1", default-features = false } tracing = { version = "0.1", default-features = false }
rand = "0.8" rand = "0.8"