Skip to content

Commit

Permalink
xxh3_64()
Browse files Browse the repository at this point in the history
  • Loading branch information
ijl committed Jul 2, 2024
1 parent c605c32 commit 1d5a2d2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 83 deletions.
81 changes: 4 additions & 77 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ optimize = []
strict_provenance = []

[dependencies]
ahash = { version = "^0.8.9", default-features = false, features = ["compile-time-rng"] }
arrayvec = { version = "0.7", default-features = false, features = ["std", "serde"] }
associative-cache = { version = "2", default-features = false }
beef = { version = "0.5", default-features = false, features = ["impl_serde"] }
Expand All @@ -75,6 +74,7 @@ serde_json = { version = "1", default-features = false, features = ["std", "floa
simdutf8 = { version = "0.1", default-features = false, features = ["std", "aarch64_neon"] }
smallvec = { version = "^1.11", default-features = false, features = ["union", "write"] }
unwinding = { version = "0.2", features = ["unwinder"], optional = true }
xxhash-rust = { version = "^0.8", default-features = false, features = ["xxh3"] }

[build-dependencies]
cc = { version = "1" }
Expand Down
6 changes: 1 addition & 5 deletions src/deserialize/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
use associative_cache::{AssociativeCache, Capacity2048, HashDirectMapped, RoundRobinReplacement};
use core::ffi::c_void;
use once_cell::unsync::OnceCell;
use std::hash::Hasher;

#[repr(transparent)]
pub struct CachedKey {
Expand Down Expand Up @@ -40,9 +39,6 @@ pub static mut KEY_MAP: OnceCell<KeyMap> = OnceCell::new();

#[inline(always)]
pub fn cache_hash(key: &[u8]) -> u64 {
// try to omit code for >64 path in ahash
assume!(key.len() <= 64);
let mut hasher = ahash::AHasher::default();
hasher.write(key);
hasher.finish()
xxhash_rust::xxh3::xxh3_64(key)
}

0 comments on commit 1d5a2d2

Please sign in to comment.