diff --git a/rbx_binary/Cargo.toml b/rbx_binary/Cargo.toml index 944c8e5e7..840fc7f34 100644 --- a/rbx_binary/Cargo.toml +++ b/rbx_binary/Cargo.toml @@ -18,6 +18,7 @@ rbx_dom_weak = { version = "2.9.0", path = "../rbx_dom_weak" } rbx_reflection = { version = "4.7.0", path = "../rbx_reflection" } rbx_reflection_database = { version = "0.2.12", path = "../rbx_reflection_database" } +ahash = "0.8.11" log = "0.4.17" lz4 = "1.23.3" thiserror = "1.0.31" diff --git a/rbx_binary/src/deserializer/state.rs b/rbx_binary/src/deserializer/state.rs index 172287f34..f47796c3d 100644 --- a/rbx_binary/src/deserializer/state.rs +++ b/rbx_binary/src/deserializer/state.rs @@ -1,10 +1,6 @@ -use std::{ - borrow::Cow, - collections::{HashMap, HashSet, VecDeque}, - convert::TryInto, - io::Read, -}; +use std::{borrow::Cow, collections::VecDeque, convert::TryInto, io::Read}; +use ahash::{HashMap, HashMapExt, HashSet, HashSetExt}; use rbx_dom_weak::{ types::{ Attributes, Axes, BinaryString, BrickColor, CFrame, Color3, Color3uint8, ColorSequence, diff --git a/rbx_binary/src/serializer/state.rs b/rbx_binary/src/serializer/state.rs index a068cca7f..ac5b70a92 100644 --- a/rbx_binary/src/serializer/state.rs +++ b/rbx_binary/src/serializer/state.rs @@ -1,10 +1,11 @@ use std::{ borrow::{Borrow, Cow}, - collections::{btree_map, BTreeMap, BTreeSet, HashMap, HashSet}, + collections::{btree_map, BTreeMap, BTreeSet}, convert::TryInto, io::Write, }; +use ahash::{HashMap, HashMapExt, HashSet, HashSetExt}; use rbx_dom_weak::{ types::{ Attributes, Axes, BinaryString, BrickColor, CFrame, Color3, Color3uint8, ColorSequence, diff --git a/rbx_dom_weak/CHANGELOG.md b/rbx_dom_weak/CHANGELOG.md index f1a05354a..27d245cbc 100644 --- a/rbx_dom_weak/CHANGELOG.md +++ b/rbx_dom_weak/CHANGELOG.md @@ -89,6 +89,14 @@ where V: Into, I: IntoIterator, ``` +* Started using [ahash](https://docs.rs/ahash/latest/ahash/) for hash maps, consequently changing the signature of `WeakDom::into_raw` from +```rust +pub fn into_raw(self) -> (Ref, HashMap) { +``` +to +```rust +pub fn into_raw(self) -> (Ref, HashMap) { +``` ### Other changes * Added `UstrMapExt`, a helper trait providing convenience methods `UstrMap::new` and `UstrMap::with_capacity`. diff --git a/rbx_dom_weak/Cargo.toml b/rbx_dom_weak/Cargo.toml index 64d4cdb15..d77f9b7be 100644 --- a/rbx_dom_weak/Cargo.toml +++ b/rbx_dom_weak/Cargo.toml @@ -14,6 +14,7 @@ edition = "2018" rbx_types = { version = "1.10.0", path = "../rbx_types", features = ["serde"] } ustr = { version = "1.1.0", features = ["serde"] } +ahash = "0.8.11" serde = "1.0.137" [dev-dependencies] diff --git a/rbx_dom_weak/src/dom.rs b/rbx_dom_weak/src/dom.rs index a9e4fa423..ef93d495a 100644 --- a/rbx_dom_weak/src/dom.rs +++ b/rbx_dom_weak/src/dom.rs @@ -1,5 +1,6 @@ -use std::collections::{HashMap, HashSet, VecDeque}; +use std::collections::VecDeque; +use ahash::{HashMap, HashMapExt, HashSet, HashSetExt}; use rbx_types::{Ref, UniqueId, Variant}; use ustr::ustr; diff --git a/rbx_xml/Cargo.toml b/rbx_xml/Cargo.toml index bedf265f5..75164fedd 100644 --- a/rbx_xml/Cargo.toml +++ b/rbx_xml/Cargo.toml @@ -15,6 +15,7 @@ rbx_dom_weak = { version = "2.9.0", path = "../rbx_dom_weak" } rbx_reflection = { version = "4.7.0", path = "../rbx_reflection" } rbx_reflection_database = { version = "0.2.12", path = "../rbx_reflection_database" } +ahash = "0.8.11" base64 = "0.13.0" log = "0.4.17" xml-rs = "0.8.4" diff --git a/rbx_xml/src/deserializer.rs b/rbx_xml/src/deserializer.rs index ec4dc876c..7eb52fbaf 100644 --- a/rbx_xml/src/deserializer.rs +++ b/rbx_xml/src/deserializer.rs @@ -1,8 +1,6 @@ -use std::{ - collections::{hash_map::Entry, HashMap, HashSet}, - io::Read, -}; +use std::{collections::hash_map::Entry, io::Read}; +use ahash::{HashMap, HashMapExt, HashSet, HashSetExt}; use log::trace; use rbx_dom_weak::{ types::{Ref, SharedString, Variant, VariantType}, diff --git a/rbx_xml/src/serializer.rs b/rbx_xml/src/serializer.rs index d4fcf8fb2..652a5f5f2 100644 --- a/rbx_xml/src/serializer.rs +++ b/rbx_xml/src/serializer.rs @@ -1,9 +1,6 @@ -use std::{ - borrow::Cow, - collections::{BTreeMap, HashMap}, - io::Write, -}; +use std::{borrow::Cow, collections::BTreeMap, io::Write}; +use ahash::{HashMap, HashMapExt}; use rbx_dom_weak::{ types::{Ref, SharedString, SharedStringHash, Variant, VariantType}, WeakDom,