From 7a9bfff95d38a0e814f6062ecd81efdb62f776f0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20misaki=20masa?= Date: Tue, 19 Aug 2025 15:58:39 +0800 Subject: [PATCH] perf: switch to a higher-performance hash algorithm (#3083) --- Cargo.lock | 8 ++++++-- yazi-actor/Cargo.toml | 1 - yazi-actor/src/lives/file.rs | 2 +- yazi-actor/src/lives/lives.rs | 2 +- yazi-actor/src/mgr/bulk_rename.rs | 3 ++- yazi-binding/Cargo.toml | 2 +- yazi-binding/src/composer.rs | 2 +- yazi-binding/src/runtime.rs | 3 ++- yazi-boot/Cargo.toml | 9 +++++---- yazi-boot/src/boot.rs | 3 ++- yazi-config/Cargo.toml | 1 + yazi-config/src/keymap/rules.rs | 3 ++- yazi-config/src/opener/opener.rs | 3 ++- yazi-config/src/plugin/plugin.rs | 3 +-- yazi-config/src/theme/icon.rs | 3 ++- yazi-core/src/cmp/cmp.rs | 3 +-- yazi-core/src/mgr/linked.rs | 3 ++- yazi-core/src/mgr/watcher.rs | 3 ++- yazi-core/src/tab/finder.rs | 3 +-- yazi-core/src/tasks/process.rs | 3 ++- yazi-dds/src/client.rs | 3 ++- yazi-dds/src/ember/bulk.rs | 3 ++- yazi-dds/src/ember/hey.rs | 3 +-- yazi-dds/src/ember/hi.rs | 3 ++- yazi-dds/src/pubsub.rs | 4 +--- yazi-dds/src/sendable.rs | 3 ++- yazi-dds/src/server.rs | 5 +++-- yazi-dds/src/state.rs | 3 ++- yazi-fs/Cargo.toml | 1 + yazi-fs/src/files.rs | 3 ++- yazi-fs/src/fns.rs | 3 ++- yazi-fs/src/mounts/linux.rs | 3 ++- yazi-fs/src/mounts/partitions.rs | 2 +- yazi-fs/src/op.rs | 3 +-- yazi-fs/src/sorter.rs | 3 ++- yazi-parser/src/app/plugin.rs | 3 ++- yazi-parser/src/mgr/update_mimes.rs | 3 +-- yazi-plugin/Cargo.toml | 1 + yazi-plugin/src/loader/loader.rs | 3 ++- yazi-scheduler/Cargo.toml | 1 + yazi-scheduler/src/hooks.rs | 3 +-- yazi-scheduler/src/ongoing.rs | 3 +-- yazi-scheduler/src/prework/prework.rs | 3 ++- yazi-shared/src/event/cmd.rs | 3 ++- yazi-shared/src/event/data.rs | 3 ++- 45 files changed, 78 insertions(+), 56 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 80a7d4e5..1fc44867 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3464,7 +3464,6 @@ version = "25.6.11" dependencies = [ "anyhow", "crossterm 0.29.0", - "foldhash", "futures", "hashbrown", "libc", @@ -3516,7 +3515,7 @@ name = "yazi-binding" version = "25.6.11" dependencies = [ "ansi-to-tui", - "foldhash", + "hashbrown", "mlua", "paste", "ratatui", @@ -3540,6 +3539,7 @@ dependencies = [ "clap_complete_fig", "clap_complete_nushell", "futures", + "hashbrown", "regex", "serde", "vergen-gitcl", @@ -3597,6 +3597,7 @@ dependencies = [ "crossterm 0.29.0", "dirs", "globset", + "hashbrown", "indexmap", "ratatui", "regex", @@ -3728,6 +3729,7 @@ dependencies = [ "dirs", "foldhash", "futures", + "hashbrown", "libc", "objc", "parking_lot", @@ -3777,6 +3779,7 @@ dependencies = [ "anyhow", "crossterm 0.29.0", "futures", + "hashbrown", "libc", "mlua", "parking_lot", @@ -3831,6 +3834,7 @@ dependencies = [ "anyhow", "async-priority-channel", "futures", + "hashbrown", "libc", "lru 0.16.0", "parking_lot", diff --git a/yazi-actor/Cargo.toml b/yazi-actor/Cargo.toml index edc84c27..b1e4389c 100644 --- a/yazi-actor/Cargo.toml +++ b/yazi-actor/Cargo.toml @@ -30,7 +30,6 @@ yazi-widgets = { path = "../yazi-widgets", version = "25.6.11" } # External dependencies anyhow = { workspace = true } crossterm = { workspace = true } -foldhash = { workspace = true } futures = { workspace = true } hashbrown = { workspace = true } mlua = { workspace = true } diff --git a/yazi-actor/src/lives/file.rs b/yazi-actor/src/lives/file.rs index c736ff26..643774b0 100644 --- a/yazi-actor/src/lives/file.rs +++ b/yazi-actor/src/lives/file.rs @@ -36,7 +36,7 @@ impl File { folder: &yazi_core::tab::Folder, tab: &yazi_core::tab::Tab, ) -> mlua::Result { - use std::collections::hash_map::Entry; + use hashbrown::hash_map::Entry; Ok(match super::FILE_CACHE.borrow_mut().entry(PtrCell(&folder.files[idx])) { Entry::Occupied(oe) => oe.into_mut().clone(), diff --git a/yazi-actor/src/lives/lives.rs b/yazi-actor/src/lives/lives.rs index 848f8c8f..5e8f2b58 100644 --- a/yazi-actor/src/lives/lives.rs +++ b/yazi-actor/src/lives/lives.rs @@ -1,6 +1,6 @@ use std::cell::RefCell; -use foldhash::HashMap; +use hashbrown::HashMap; use mlua::{AnyUserData, UserData}; use scopeguard::defer; use tracing::error; diff --git a/yazi-actor/src/mgr/bulk_rename.rs b/yazi-actor/src/mgr/bulk_rename.rs index 3e8e805a..7773317d 100644 --- a/yazi-actor/src/mgr/bulk_rename.rs +++ b/yazi-actor/src/mgr/bulk_rename.rs @@ -1,7 +1,8 @@ -use std::{borrow::Cow, collections::HashMap, ffi::{OsStr, OsString}, hash::Hash, io::{Read, Write}, ops::Deref, path::Path}; +use std::{borrow::Cow, ffi::{OsStr, OsString}, hash::Hash, io::{Read, Write}, ops::Deref, path::Path}; use anyhow::{Result, anyhow}; use crossterm::{execute, style::Print}; +use hashbrown::HashMap; use scopeguard::defer; use tokio::io::AsyncWriteExt; use yazi_config::{YAZI, opener::OpenerRule}; diff --git a/yazi-binding/Cargo.toml b/yazi-binding/Cargo.toml index 1fb7e0c2..0fe12131 100644 --- a/yazi-binding/Cargo.toml +++ b/yazi-binding/Cargo.toml @@ -21,7 +21,7 @@ yazi-shared = { path = "../yazi-shared", version = "25.6.11" } # External dependencies ansi-to-tui = { workspace = true } -foldhash = { workspace = true } +hashbrown = { workspace = true } mlua = { workspace = true } paste = { workspace = true } ratatui = { workspace = true } diff --git a/yazi-binding/src/composer.rs b/yazi-binding/src/composer.rs index 95c7f68b..ebfc5bd2 100644 --- a/yazi-binding/src/composer.rs +++ b/yazi-binding/src/composer.rs @@ -1,4 +1,4 @@ -use foldhash::HashMap; +use hashbrown::HashMap; use mlua::{Lua, MetaMethod, UserData, UserDataMethods, Value}; pub type ComposerGet = fn(&Lua, &[u8]) -> mlua::Result; diff --git a/yazi-binding/src/runtime.rs b/yazi-binding/src/runtime.rs index 17da1ad2..2eec279b 100644 --- a/yazi-binding/src/runtime.rs +++ b/yazi-binding/src/runtime.rs @@ -1,5 +1,6 @@ -use std::collections::{HashMap, VecDeque}; +use std::collections::VecDeque; +use hashbrown::HashMap; use mlua::Function; #[derive(Debug, Default)] diff --git a/yazi-boot/Cargo.toml b/yazi-boot/Cargo.toml index 407f117c..f0aef482 100644 --- a/yazi-boot/Cargo.toml +++ b/yazi-boot/Cargo.toml @@ -16,10 +16,11 @@ yazi-macro = { path = "../yazi-macro", version = "25.6.11" } yazi-shared = { path = "../yazi-shared", version = "25.6.11" } # External dependencies -clap = { workspace = true } -futures = { workspace = true } -regex = { workspace = true } -serde = { workspace = true } +clap = { workspace = true } +futures = { workspace = true } +hashbrown = { workspace = true } +regex = { workspace = true } +serde = { workspace = true } [build-dependencies] yazi-shared = { path = "../yazi-shared", version = "25.6.11" } diff --git a/yazi-boot/src/boot.rs b/yazi-boot/src/boot.rs index dd6b8e57..dfa0c04b 100644 --- a/yazi-boot/src/boot.rs +++ b/yazi-boot/src/boot.rs @@ -1,6 +1,7 @@ -use std::{collections::HashSet, path::PathBuf}; +use std::path::PathBuf; use futures::executor::block_on; +use hashbrown::HashSet; use serde::Serialize; use yazi_fs::{CWD, Xdg, path::expand_url, provider}; use yazi_shared::url::{UrlBuf, UrnBuf}; diff --git a/yazi-config/Cargo.toml b/yazi-config/Cargo.toml index 23181ef0..6e1eb31c 100644 --- a/yazi-config/Cargo.toml +++ b/yazi-config/Cargo.toml @@ -21,6 +21,7 @@ bitflags = { workspace = true } crossterm = { workspace = true } dirs = { workspace = true } globset = { workspace = true } +hashbrown = { workspace = true } indexmap = { workspace = true } ratatui = { workspace = true } regex = { workspace = true } diff --git a/yazi-config/src/keymap/rules.rs b/yazi-config/src/keymap/rules.rs index 41a5ee01..1fcf8897 100644 --- a/yazi-config/src/keymap/rules.rs +++ b/yazi-config/src/keymap/rules.rs @@ -1,6 +1,7 @@ -use std::{collections::HashSet, ops::Deref}; +use std::ops::Deref; use anyhow::Result; +use hashbrown::HashSet; use serde::Deserialize; use yazi_codegen::DeserializeOver2; use yazi_shared::Layer; diff --git a/yazi-config/src/opener/opener.rs b/yazi-config/src/opener/opener.rs index 900e27a3..f6e97a78 100644 --- a/yazi-config/src/opener/opener.rs +++ b/yazi-config/src/opener/opener.rs @@ -1,6 +1,7 @@ -use std::{collections::HashMap, mem, ops::Deref}; +use std::{mem, ops::Deref}; use anyhow::Result; +use hashbrown::HashMap; use indexmap::IndexSet; use serde::Deserialize; diff --git a/yazi-config/src/plugin/plugin.rs b/yazi-config/src/plugin/plugin.rs index 01452606..d4c54ed1 100644 --- a/yazi-config/src/plugin/plugin.rs +++ b/yazi-config/src/plugin/plugin.rs @@ -1,6 +1,5 @@ -use std::collections::HashSet; - use anyhow::Result; +use hashbrown::HashSet; use serde::Deserialize; use tracing::warn; use yazi_codegen::DeserializeOver2; diff --git a/yazi-config/src/theme/icon.rs b/yazi-config/src/theme/icon.rs index 1916f37c..ffd9ba20 100644 --- a/yazi-config/src/theme/icon.rs +++ b/yazi-config/src/theme/icon.rs @@ -1,6 +1,7 @@ -use std::{collections::HashMap, ops::Deref}; +use std::ops::Deref; use anyhow::Result; +use hashbrown::HashMap; use serde::{Deserialize, Deserializer}; use yazi_codegen::DeserializeOver2; use yazi_fs::File; diff --git a/yazi-core/src/cmp/cmp.rs b/yazi-core/src/cmp/cmp.rs index b4663fb0..1a46e792 100644 --- a/yazi-core/src/cmp/cmp.rs +++ b/yazi-core/src/cmp/cmp.rs @@ -1,5 +1,4 @@ -use std::collections::HashMap; - +use hashbrown::HashMap; use yazi_parser::cmp::CmpItem; use yazi_shared::{Id, url::UrlBuf}; use yazi_widgets::Scrollable; diff --git a/yazi-core/src/mgr/linked.rs b/yazi-core/src/mgr/linked.rs index 522b313d..aade9d5a 100644 --- a/yazi-core/src/mgr/linked.rs +++ b/yazi-core/src/mgr/linked.rs @@ -1,5 +1,6 @@ -use std::{collections::HashMap, iter, ops::{Deref, DerefMut}}; +use std::{iter, ops::{Deref, DerefMut}}; +use hashbrown::HashMap; use yazi_shared::url::{Url, UrlBuf}; #[derive(Default)] diff --git a/yazi-core/src/mgr/watcher.rs b/yazi-core/src/mgr/watcher.rs index 63d69e74..87be9510 100644 --- a/yazi-core/src/mgr/watcher.rs +++ b/yazi-core/src/mgr/watcher.rs @@ -1,6 +1,7 @@ -use std::{collections::{HashMap, HashSet}, time::Duration}; +use std::time::Duration; use anyhow::Result; +use hashbrown::{HashMap, HashSet}; use notify::{PollWatcher, RecommendedWatcher, RecursiveMode, Watcher as _Watcher}; use parking_lot::RwLock; use tokio::{pin, sync::{mpsc::{self, UnboundedReceiver}, watch}}; diff --git a/yazi-core/src/tab/finder.rs b/yazi-core/src/tab/finder.rs index 6ecf9a0c..7c02d51d 100644 --- a/yazi-core/src/tab/finder.rs +++ b/yazi-core/src/tab/finder.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; - use anyhow::Result; +use hashbrown::HashMap; use yazi_fs::{Files, Filter, FilterCase}; use yazi_shared::url::{UrlBuf, Urn, UrnBuf}; diff --git a/yazi-core/src/tasks/process.rs b/yazi-core/src/tasks/process.rs index ac02b48c..efaca89d 100644 --- a/yazi-core/src/tasks/process.rs +++ b/yazi-core/src/tasks/process.rs @@ -1,5 +1,6 @@ -use std::{borrow::Cow, collections::HashMap, ffi::OsString, mem}; +use std::{borrow::Cow, ffi::OsString, mem}; +use hashbrown::HashMap; use yazi_config::{YAZI, opener::OpenerRule}; use yazi_parser::tasks::ProcessExecOpt; use yazi_shared::url::UrlBuf; diff --git a/yazi-dds/src/client.rs b/yazi-dds/src/client.rs index d2972e13..8eff392d 100644 --- a/yazi-dds/src/client.rs +++ b/yazi-dds/src/client.rs @@ -1,6 +1,7 @@ -use std::{collections::{HashMap, HashSet}, iter, mem, str::FromStr}; +use std::{iter, mem, str::FromStr}; use anyhow::{Context, Result, bail}; +use hashbrown::{HashMap, HashSet}; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; use tokio::{io::AsyncWriteExt, select, sync::mpsc, task::JoinHandle, time}; diff --git a/yazi-dds/src/ember/bulk.rs b/yazi-dds/src/ember/bulk.rs index 2edae315..2847db2a 100644 --- a/yazi-dds/src/ember/bulk.rs +++ b/yazi-dds/src/ember/bulk.rs @@ -1,5 +1,6 @@ -use std::{borrow::Cow, collections::HashMap}; +use std::borrow::Cow; +use hashbrown::HashMap; use mlua::{IntoLua, Lua, Value}; use serde::{Deserialize, Serialize}; use yazi_shared::url::UrlBuf; diff --git a/yazi-dds/src/ember/hey.rs b/yazi-dds/src/ember/hey.rs index 5839d46a..cd317a7e 100644 --- a/yazi-dds/src/ember/hey.rs +++ b/yazi-dds/src/ember/hey.rs @@ -1,5 +1,4 @@ -use std::collections::HashMap; - +use hashbrown::HashMap; use mlua::{ExternalResult, IntoLua, Lua, Value}; use serde::{Deserialize, Serialize}; use yazi_shared::{Id, SStr}; diff --git a/yazi-dds/src/ember/hi.rs b/yazi-dds/src/ember/hi.rs index 41ffccf9..e62cda38 100644 --- a/yazi-dds/src/ember/hi.rs +++ b/yazi-dds/src/ember/hi.rs @@ -1,5 +1,6 @@ -use std::{borrow::Cow, collections::HashSet}; +use std::borrow::Cow; +use hashbrown::HashSet; use mlua::{ExternalResult, IntoLua, Lua, Value}; use serde::{Deserialize, Serialize}; use yazi_shared::SStr; diff --git a/yazi-dds/src/pubsub.rs b/yazi-dds/src/pubsub.rs index cbc08833..973b8400 100644 --- a/yazi-dds/src/pubsub.rs +++ b/yazi-dds/src/pubsub.rs @@ -1,7 +1,5 @@ -use std::collections::HashMap; - use anyhow::Result; -use hashbrown::HashSet; +use hashbrown::{HashMap, HashSet}; use mlua::Function; use parking_lot::RwLock; use yazi_boot::BOOT; diff --git a/yazi-dds/src/sendable.rs b/yazi-dds/src/sendable.rs index 87b23cb3..4759ed16 100644 --- a/yazi-dds/src/sendable.rs +++ b/yazi-dds/src/sendable.rs @@ -1,5 +1,6 @@ -use std::{any::TypeId, borrow::Cow, collections::HashMap}; +use std::{any::TypeId, borrow::Cow}; +use hashbrown::HashMap; use mlua::{ExternalError, IntoLua, Lua, MultiValue, Table, Value}; use ordered_float::OrderedFloat; use yazi_shared::{event::{Data, DataKey}, replace_cow}; diff --git a/yazi-dds/src/server.rs b/yazi-dds/src/server.rs index d8158b6f..2abd461e 100644 --- a/yazi-dds/src/server.rs +++ b/yazi-dds/src/server.rs @@ -1,6 +1,7 @@ -use std::{collections::HashMap, str::FromStr, time::Duration}; +use std::{str::FromStr, time::Duration}; use anyhow::Result; +use hashbrown::HashMap; use parking_lot::RwLock; use tokio::{io::{AsyncBufReadExt, AsyncWriteExt, BufReader}, select, sync::mpsc::{self, UnboundedReceiver}, task::JoinHandle, time}; use yazi_macro::try_format; @@ -51,7 +52,7 @@ impl Server { let mut parts = line.splitn(4, ','); let Some(kind) = parts.next() else { continue }; - let Some(receiver) = parts.next().and_then(|s| s.parse().ok()) else { continue }; + let Some(receiver) = parts.next().and_then(|s| s.parse::().ok()) else { continue }; let Some(sender) = parts.next().and_then(|s| s.parse::().ok()) else { continue }; let clients = CLIENTS.read(); diff --git a/yazi-dds/src/state.rs b/yazi-dds/src/state.rs index e9e11043..8ba5d5c3 100644 --- a/yazi-dds/src/state.rs +++ b/yazi-dds/src/state.rs @@ -1,6 +1,7 @@ -use std::{collections::HashMap, mem, ops::Deref, sync::atomic::{AtomicU64, Ordering}, time::UNIX_EPOCH}; +use std::{mem, ops::Deref, sync::atomic::{AtomicU64, Ordering}, time::UNIX_EPOCH}; use anyhow::Result; +use hashbrown::HashMap; use parking_lot::RwLock; use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufWriter}; use yazi_boot::BOOT; diff --git a/yazi-fs/Cargo.toml b/yazi-fs/Cargo.toml index 5459a0ab..f43538b2 100644 --- a/yazi-fs/Cargo.toml +++ b/yazi-fs/Cargo.toml @@ -20,6 +20,7 @@ bitflags = { workspace = true } dirs = { workspace = true } foldhash = { workspace = true } futures = { workspace = true } +hashbrown = { workspace = true } parking_lot = { workspace = true } regex = { workspace = true } scopeguard = { workspace = true } diff --git a/yazi-fs/src/files.rs b/yazi-fs/src/files.rs index 9c05d1aa..84a58efa 100644 --- a/yazi-fs/src/files.rs +++ b/yazi-fs/src/files.rs @@ -1,5 +1,6 @@ -use std::{collections::{HashMap, HashSet}, mem, ops::{Deref, DerefMut, Not}}; +use std::{mem, ops::{Deref, DerefMut, Not}}; +use hashbrown::{HashMap, HashSet}; use tokio::{select, sync::mpsc::{self, UnboundedReceiver}}; use yazi_shared::{Id, url::{UrlBuf, Urn, UrnBuf}}; diff --git a/yazi-fs/src/fns.rs b/yazi-fs/src/fns.rs index 63ec74dc..cf55d9fa 100644 --- a/yazi-fs/src/fns.rs +++ b/yazi-fs/src/fns.rs @@ -1,8 +1,9 @@ // FIXME: VFS -use std::{borrow::Cow, collections::{HashMap, HashSet}, ffi::{OsStr, OsString}, path::{Path, PathBuf}}; +use std::{borrow::Cow, ffi::{OsStr, OsString}, path::{Path, PathBuf}}; use anyhow::{Result, bail}; +use hashbrown::{HashMap, HashSet}; use tokio::{fs, io, select, sync::{mpsc, oneshot}, time}; use yazi_shared::url::{Component, Url, UrlBuf}; diff --git a/yazi-fs/src/mounts/linux.rs b/yazi-fs/src/mounts/linux.rs index d93c84ae..55e8d555 100644 --- a/yazi-fs/src/mounts/linux.rs +++ b/yazi-fs/src/mounts/linux.rs @@ -1,6 +1,7 @@ -use std::{borrow::Cow, collections::{HashMap, HashSet}, ffi::{OsStr, OsString}, os::{fd::AsFd, unix::{ffi::{OsStrExt, OsStringExt}, fs::MetadataExt}}, time::Duration}; +use std::{borrow::Cow, ffi::{OsStr, OsString}, os::{fd::AsFd, unix::{ffi::{OsStrExt, OsStringExt}, fs::MetadataExt}}, time::Duration}; use anyhow::{Context, Result}; +use hashbrown::{HashMap, HashSet}; use tokio::{io::{Interest, unix::AsyncFd}, time::sleep}; use tracing::error; use yazi_shared::{natsort, replace_cow, replace_vec_cow}; diff --git a/yazi-fs/src/mounts/partitions.rs b/yazi-fs/src/mounts/partitions.rs index eacee155..f439ddc9 100644 --- a/yazi-fs/src/mounts/partitions.rs +++ b/yazi-fs/src/mounts/partitions.rs @@ -14,7 +14,7 @@ pub static PARTITIONS: RoCell = RoCell::new(); pub struct Partitions { pub(super) inner: Vec, #[cfg(target_os = "linux")] - pub(super) linux_cache: std::collections::HashSet, + pub(super) linux_cache: hashbrown::HashSet, #[cfg(target_os = "macos")] pub(super) need_update: bool, } diff --git a/yazi-fs/src/op.rs b/yazi-fs/src/op.rs index 008b817d..419d7773 100644 --- a/yazi-fs/src/op.rs +++ b/yazi-fs/src/op.rs @@ -1,5 +1,4 @@ -use std::collections::{HashMap, HashSet}; - +use hashbrown::{HashMap, HashSet}; use yazi_macro::relay; use yazi_shared::{Id, Ids, url::{UrlBuf, UrnBuf}}; diff --git a/yazi-fs/src/sorter.rs b/yazi-fs/src/sorter.rs index 522eefc4..2e3a8544 100644 --- a/yazi-fs/src/sorter.rs +++ b/yazi-fs/src/sorter.rs @@ -1,5 +1,6 @@ -use std::{cmp::Ordering, collections::HashMap}; +use std::cmp::Ordering; +use hashbrown::HashMap; use yazi_shared::{LcgRng, natsort, translit::Transliterator, url::UrnBuf}; use crate::{File, SortBy}; diff --git a/yazi-parser/src/app/plugin.rs b/yazi-parser/src/app/plugin.rs index 5016271a..3b313401 100644 --- a/yazi-parser/src/app/plugin.rs +++ b/yazi-parser/src/app/plugin.rs @@ -1,6 +1,7 @@ -use std::{collections::HashMap, fmt::Debug}; +use std::fmt::Debug; use anyhow::bail; +use hashbrown::HashMap; use mlua::{Lua, Table}; use yazi_shared::{SStr, event::{Cmd, CmdCow, Data, DataKey}}; diff --git a/yazi-parser/src/mgr/update_mimes.rs b/yazi-parser/src/mgr/update_mimes.rs index d0648241..fc159f84 100644 --- a/yazi-parser/src/mgr/update_mimes.rs +++ b/yazi-parser/src/mgr/update_mimes.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; - use anyhow::bail; +use hashbrown::HashMap; use mlua::{ExternalError, FromLua, IntoLua, Lua, Value}; use yazi_shared::event::{CmdCow, Data, DataKey}; diff --git a/yazi-plugin/Cargo.toml b/yazi-plugin/Cargo.toml index 2eefb5d8..45210bf9 100644 --- a/yazi-plugin/Cargo.toml +++ b/yazi-plugin/Cargo.toml @@ -29,6 +29,7 @@ yazi-widgets = { path = "../yazi-widgets", version = "25.6.11" } anyhow = { workspace = true } crossterm = { workspace = true } futures = { workspace = true } +hashbrown = { workspace = true } mlua = { workspace = true } parking_lot = { workspace = true } paste = { workspace = true } diff --git a/yazi-plugin/src/loader/loader.rs b/yazi-plugin/src/loader/loader.rs index 935e214b..797ca1a4 100644 --- a/yazi-plugin/src/loader/loader.rs +++ b/yazi-plugin/src/loader/loader.rs @@ -1,6 +1,7 @@ -use std::{borrow::Cow, collections::HashMap, ops::Deref}; +use std::{borrow::Cow, ops::Deref}; use anyhow::{Context, Result, bail}; +use hashbrown::HashMap; use mlua::{ChunkMode, ExternalError, Lua, Table}; use parking_lot::RwLock; use yazi_boot::BOOT; diff --git a/yazi-scheduler/Cargo.toml b/yazi-scheduler/Cargo.toml index 583d380a..757df4dd 100644 --- a/yazi-scheduler/Cargo.toml +++ b/yazi-scheduler/Cargo.toml @@ -22,6 +22,7 @@ yazi-shared = { path = "../yazi-shared", version = "25.6.11" } anyhow = { workspace = true } async-priority-channel = "0.2.0" futures = { workspace = true } +hashbrown = { workspace = true } lru = { workspace = true } parking_lot = { workspace = true } scopeguard = { workspace = true } diff --git a/yazi-scheduler/src/hooks.rs b/yazi-scheduler/src/hooks.rs index b2f0840f..09baa5a9 100644 --- a/yazi-scheduler/src/hooks.rs +++ b/yazi-scheduler/src/hooks.rs @@ -1,6 +1,5 @@ -use std::collections::HashMap; - use futures::future::BoxFuture; +use hashbrown::HashMap; use yazi_shared::Id; #[derive(Default)] diff --git a/yazi-scheduler/src/ongoing.rs b/yazi-scheduler/src/ongoing.rs index 8705140a..3ed63084 100644 --- a/yazi-scheduler/src/ongoing.rs +++ b/yazi-scheduler/src/ongoing.rs @@ -1,5 +1,4 @@ -use std::collections::HashMap; - +use hashbrown::HashMap; use yazi_config::YAZI; use yazi_parser::app::TasksProgress; use yazi_shared::{Id, Ids}; diff --git a/yazi-scheduler/src/prework/prework.rs b/yazi-scheduler/src/prework/prework.rs index 53114c85..9bf45afd 100644 --- a/yazi-scheduler/src/prework/prework.rs +++ b/yazi-scheduler/src/prework/prework.rs @@ -1,6 +1,7 @@ -use std::{collections::{HashMap, HashSet}, num::NonZeroUsize}; +use std::num::NonZeroUsize; use anyhow::{Result, anyhow}; +use hashbrown::{HashMap, HashSet}; use lru::LruCache; use parking_lot::{Mutex, RwLock}; use tokio::sync::mpsc; diff --git a/yazi-shared/src/event/cmd.rs b/yazi-shared/src/event/cmd.rs index cb9cdff0..962c2166 100644 --- a/yazi-shared/src/event/cmd.rs +++ b/yazi-shared/src/event/cmd.rs @@ -1,6 +1,7 @@ -use std::{any::Any, borrow::Cow, collections::HashMap, fmt::{self, Display}, mem, str::FromStr}; +use std::{any::Any, borrow::Cow, fmt::{self, Display}, mem, str::FromStr}; use anyhow::{Result, anyhow, bail}; +use hashbrown::HashMap; use serde::{Deserialize, de}; use super::{Data, DataKey}; diff --git a/yazi-shared/src/event/data.rs b/yazi-shared/src/event/data.rs index 5c41cee6..2d9c2118 100644 --- a/yazi-shared/src/event/data.rs +++ b/yazi-shared/src/event/data.rs @@ -1,6 +1,7 @@ -use std::{any::Any, borrow::Cow, collections::HashMap}; +use std::{any::Any, borrow::Cow}; use anyhow::{Result, bail}; +use hashbrown::HashMap; use ordered_float::OrderedFloat; use serde::{Deserialize, Serialize, de};