perf: use rustc-hash for HashMap and HashSet

This commit is contained in:
Cheong Lau 2025-10-22 02:33:30 +00:00 committed by GitHub
parent 4dae45733e
commit 5369b4eb29
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 46 additions and 26 deletions

View file

@ -1,8 +1,9 @@
// Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only
use rustc_hash::FxHashMap;
use std::{
collections::{HashMap, HashSet},
fmt::Debug,
hash::Hash,
mem,
@ -357,7 +358,7 @@ pub struct BluerSessionState {
wake_up_discover_tx: Sender<()>,
wake_up_discover_rx: Option<Receiver<()>>,
tx: Sender<BluerSessionEvent>,
active_requests: Arc<Mutex<HashMap<BluerRequest, JoinHandle<anyhow::Result<()>>>>>,
active_requests: Arc<Mutex<FxHashMap<BluerRequest, JoinHandle<anyhow::Result<()>>>>>,
}
impl BluerSessionState {
@ -540,7 +541,7 @@ impl BluerSessionState {
wake_up_discover_rx: Some(wake_up_discover_rx),
wake_up_discover_tx,
tx,
active_requests: Arc::new(Mutex::new(HashMap::new())),
active_requests: Default::default(),
};
self_.process_requests(req_rx);
self_.process_changes();