perf: refactor IRuntime to use HashSet for exists_keys and improve related functions performance

This commit is contained in:
Tunglies
2025-11-22 16:25:23 +08:00
parent c82cefe80e
commit 82bed4910e
4 changed files with 68 additions and 58 deletions

View File

@@ -9,7 +9,7 @@ use anyhow::{Result, anyhow};
use clash_verge_logging::{Type, logging};
use clash_verge_types::runtime::IRuntime;
use smartstring::alias::String;
use std::{path::PathBuf, time::Instant};
use std::{collections::HashSet, path::PathBuf, time::Instant};
use tauri_plugin_mihomo::Error as MihomoError;
impl CoreManager {
@@ -22,7 +22,7 @@ impl CoreManager {
Config::runtime().await.edit_draft(|d| {
*d = IRuntime {
config: Some(clash_config.to_owned()),
exists_keys: vec![],
exists_keys: HashSet::new(),
chain_logs: Default::default(),
}
});