Skip to content

Commit e97b75e

Browse files
committed
use rustc-hash
1 parent f76f169 commit e97b75e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

opentelemetry-sdk/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ tokio-stream = { workspace = true, optional = true }
3030
http = { workspace = true, optional = true }
3131
tracing = {workspace = true, optional = true}
3232
crossbeam-utils = "0.8.20"
33+
rustc-hash = "2.0.0"
3334

3435
[package.metadata.docs.rs]
3536
all-features = true

opentelemetry-sdk/src/metrics/internal/hashed.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
use std::{
22
borrow::{Borrow, Cow},
3-
hash::{BuildHasher, DefaultHasher, Hash, Hasher},
3+
hash::{BuildHasher, Hash, Hasher},
44
ops::Deref,
55
};
66

7+
use rustc_hash::FxHasher;
8+
79
/// Hash value only once, works with references and owned types.
810
pub(crate) struct Hashed<'a, T>
911
where
@@ -54,7 +56,7 @@ fn calc_hash<T>(value: T) -> u64
5456
where
5557
T: Hash,
5658
{
57-
let mut hasher = DefaultHasher::default();
59+
let mut hasher = FxHasher::default();
5860
value.hash(&mut hasher);
5961
hasher.finish()
6062
}

0 commit comments

Comments
 (0)