From 5a7917f292166987a8f745f73dc53c219386ed0d Mon Sep 17 00:00:00 2001 From: Toshit Chawda Date: Sat, 7 Dec 2024 13:05:12 -0800 Subject: [PATCH] use rustc hash --- Cargo.lock | 14 +++++++------- wisp/Cargo.toml | 2 +- wisp/src/mux/inner.rs | 12 ++++++------ 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c34562a..cb782a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1649,12 +1649,6 @@ dependencies = [ "libc", ] -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - [[package]] name = "nom" version = "7.1.3" @@ -2004,6 +1998,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" + [[package]] name = "rustc_version" version = "0.4.1" @@ -3206,9 +3206,9 @@ dependencies = [ "flume", "futures", "getrandom", - "nohash-hasher", "pin-project-lite", "reusable-box-future", + "rustc-hash", "thiserror 2.0.3", "tokio", ] diff --git a/wisp/Cargo.toml b/wisp/Cargo.toml index 608ffd4..cbc60c0 100644 --- a/wisp/Cargo.toml +++ b/wisp/Cargo.toml @@ -24,9 +24,9 @@ fastwebsockets = { version = "0.8.0", features = ["unstable-split"], optional = flume = "0.11.0" futures = "0.3.30" getrandom = { version = "0.2.15", features = ["std"], optional = true } -nohash-hasher = "0.2.0" pin-project-lite = "0.2.14" reusable-box-future = "0.2.0" +rustc-hash = "2.1.0" thiserror = "2.0.3" tokio = { version = "1.39.3", optional = true, default-features = false } diff --git a/wisp/src/mux/inner.rs b/wisp/src/mux/inner.rs index 4917f27..6a6a794 100644 --- a/wisp/src/mux/inner.rs +++ b/wisp/src/mux/inner.rs @@ -1,7 +1,7 @@ -use std::sync::{ +use std::{collections::HashMap, sync::{ atomic::{AtomicBool, AtomicU32, Ordering}, Arc, -}; +}}; use crate::{ extensions::AnyProtocolExtension, @@ -13,7 +13,7 @@ use bytes::BytesMut; use event_listener::Event; use flume as mpsc; use futures::{channel::oneshot, select, stream::unfold, FutureExt, StreamExt}; -use nohash_hasher::IntMap; +use rustc_hash::FxHashMap; pub(crate) enum WsEvent { Close(Packet<'static>, oneshot::Sender>), @@ -60,7 +60,7 @@ pub(crate) struct MuxInner>, fut_exited: Arc, - stream_map: IntMap, + stream_map: FxHashMap, buffer_size: u32, target_buffer_size: u32, @@ -122,7 +122,7 @@ impl MuxInner { role: Role::Server, - stream_map: IntMap::default(), + stream_map: HashMap::default(), server_tx, }, @@ -162,7 +162,7 @@ impl MuxInner { role: Role::Client, - stream_map: IntMap::default(), + stream_map: HashMap::default(), server_tx, },