diff --git a/tracing-log/Cargo.toml b/tracing-log/Cargo.toml index 4c1be5686..5c3a5e1e1 100644 --- a/tracing-log/Cargo.toml +++ b/tracing-log/Cargo.toml @@ -21,19 +21,19 @@ rust-version = "1.65.0" default = ["log-tracer", "std"] std = ["log/std"] log-tracer = [] -interest-cache = ["lru", "ahash"] +interest-cache = ["lru","rapidhash"] [dependencies] tracing-core = { path = "../tracing-core", version = "0.1.28"} log = { version = "0.4.17" } once_cell = "1.13.0" lru = { version = "0.7.7", optional = true } -ahash = { version = "0.7.7", optional = true } +rapidhash = { version = "3.0.0", default-features = false, optional = true } [dev-dependencies] tracing = { path = "../tracing", version = "0.1.35"} tracing-subscriber = { path = "../tracing-subscriber" } -criterion = { version = "0.3.6", default-features = false } +criterion = { version = "0.7.0", default-features = false } [badges] maintenance = { status = "actively-maintained" } diff --git a/tracing-log/src/interest_cache.rs b/tracing-log/src/interest_cache.rs index 5ad9c1362..7c41294f0 100644 --- a/tracing-log/src/interest_cache.rs +++ b/tracing-log/src/interest_cache.rs @@ -1,7 +1,7 @@ -use ahash::AHasher; use log::{Level, Metadata}; use lru::LruCache; use once_cell::sync::Lazy; +use rapidhash::fast::{RapidHasher, RandomState as RapidRandomState}; use std::cell::RefCell; use std::hash::Hasher; use std::sync::atomic::{AtomicUsize, Ordering}; @@ -90,7 +90,7 @@ struct Key { struct State { min_verbosity: Level, epoch: usize, - cache: LruCache, + cache: LruCache, } impl State { @@ -98,7 +98,7 @@ impl State { State { epoch, min_verbosity: config.min_verbosity, - cache: LruCache::new(config.lru_cache_size), + cache: LruCache::with_hasher(config.lru_cache_size, RapidRandomState::default()), } } } @@ -175,7 +175,7 @@ pub(crate) fn try_cache(metadata: &Metadata<'_>, callback: impl FnOnce() -> bool let target = metadata.target(); - let mut hasher = AHasher::default(); + let mut hasher = RapidHasher::default(); hasher.write(target.as_bytes()); const HASH_MASK: u64 = !1;