Migrate twox-hash -> xxhash_rust. Switch to Xxh3 for better performance.
xxhash-rust is more maintained, built against `::core`, so no workaround for wasm is necessary. Switch to Xxh3 for better performance, which shows when loading/hashing image buffers.
This commit is contained in:
parent
751ea77c29
commit
98e088e731
6 changed files with 8 additions and 19 deletions
|
|
@ -150,7 +150,7 @@ thiserror = "1.0"
|
||||||
tiny-skia = "0.10"
|
tiny-skia = "0.10"
|
||||||
tokio = "1.0"
|
tokio = "1.0"
|
||||||
tracing = "0.1"
|
tracing = "0.1"
|
||||||
twox-hash = { version = "1.0", default-features = false }
|
xxhash-rust = { version = "0.8.7", default-features = false, features = ["xxh3"] }
|
||||||
unicode-segmentation = "1.0"
|
unicode-segmentation = "1.0"
|
||||||
wasm-bindgen-futures = "0.4"
|
wasm-bindgen-futures = "0.4"
|
||||||
wasm-timer = "0.2"
|
wasm-timer = "0.2"
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ keywords.workspace = true
|
||||||
bitflags.workspace = true
|
bitflags.workspace = true
|
||||||
log.workspace = true
|
log.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
twox-hash.workspace = true
|
xxhash-rust.workspace = true
|
||||||
num-traits.workspace = true
|
num-traits.workspace = true
|
||||||
|
|
||||||
palette.workspace = true
|
palette.workspace = true
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
/// The hasher used to compare layouts.
|
/// The hasher used to compare layouts.
|
||||||
#[derive(Debug, Default)]
|
#[allow(missing_debug_implementations)] // Doesn't really make sense to have debug on the hasher state anyways.
|
||||||
pub struct Hasher(twox_hash::XxHash64);
|
#[derive(Default)]
|
||||||
|
pub struct Hasher(xxhash_rust::xxh3::Xxh3);
|
||||||
|
|
||||||
impl core::hash::Hasher for Hasher {
|
impl core::hash::Hasher for Hasher {
|
||||||
fn write(&mut self, bytes: &[u8]) {
|
fn write(&mut self, bytes: &[u8]) {
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ once_cell.workspace = true
|
||||||
raw-window-handle.workspace = true
|
raw-window-handle.workspace = true
|
||||||
rustc-hash.workspace = true
|
rustc-hash.workspace = true
|
||||||
thiserror.workspace = true
|
thiserror.workspace = true
|
||||||
twox-hash.workspace = true
|
|
||||||
unicode-segmentation.workspace = true
|
unicode-segmentation.workspace = true
|
||||||
|
xxhash-rust.workspace = true
|
||||||
|
|
||||||
image.workspace = true
|
image.workspace = true
|
||||||
image.optional = true
|
image.optional = true
|
||||||
|
|
@ -44,7 +44,3 @@ kamadak-exif.optional = true
|
||||||
|
|
||||||
lyon_path.workspace = true
|
lyon_path.workspace = true
|
||||||
lyon_path.optional = true
|
lyon_path.optional = true
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
|
||||||
twox-hash.workspace = true
|
|
||||||
twox-hash.features = ["std"]
|
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,7 @@ pub struct Cache {
|
||||||
hasher: HashBuilder,
|
hasher: HashBuilder,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
type HashBuilder = xxhash_rust::xxh3::Xxh3Builder;
|
||||||
type HashBuilder = twox_hash::RandomXxHashBuilder64;
|
|
||||||
|
|
||||||
#[cfg(target_arch = "wasm32")]
|
|
||||||
type HashBuilder = std::hash::BuildHasherDefault<twox_hash::XxHash64>;
|
|
||||||
|
|
||||||
impl Cache {
|
impl Cache {
|
||||||
/// Creates a new empty [`Cache`].
|
/// Creates a new empty [`Cache`].
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,7 @@ raw-window-handle.workspace = true
|
||||||
rustc-hash.workspace = true
|
rustc-hash.workspace = true
|
||||||
softbuffer.workspace = true
|
softbuffer.workspace = true
|
||||||
tiny-skia.workspace = true
|
tiny-skia.workspace = true
|
||||||
twox-hash.workspace = true
|
xxhash-rust.workspace = true
|
||||||
|
|
||||||
resvg.workspace = true
|
resvg.workspace = true
|
||||||
resvg.optional = true
|
resvg.optional = true
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
|
||||||
twox-hash.workspace = true
|
|
||||||
twox-hash.features = ["std"]
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue