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

@ -17,6 +17,7 @@ i18n-embed-fl.workspace = true
i18n-embed.workspace = true
libcosmic.workspace = true
rust-embed.workspace = true
rustc-hash.workspace = true
tokio.workspace = true
tracing-log.workspace = true
tracing-subscriber.workspace = true

View file

@ -40,7 +40,8 @@ use cosmic_settings_subscriptions::{
};
use cosmic_time::{Instant, Timeline, anim, chain, id};
use std::{collections::HashMap, path::PathBuf, sync::LazyLock, time::Duration};
use rustc_hash::FxHashMap;
use std::{path::PathBuf, sync::LazyLock, time::Duration};
use tokio::sync::mpsc::UnboundedSender;
// XXX improve
@ -80,7 +81,7 @@ struct CosmicBatteryApplet {
charging_limit: Option<bool>,
battery_percent: f64,
on_battery: bool,
gpus: HashMap<PathBuf, GPUData>,
gpus: FxHashMap<PathBuf, GPUData>,
update_trigger: Option<UnboundedSender<()>>,
time_remaining: Duration,
max_kbd_brightness: Option<i32>,