mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
PreHashedMap was introduced as a performance optimization. It is, however, potentially unsound as it cannot distinguish between keys that are not equal yet have the same hash. This patch replaces its usage with a simple FastHashMap, which should be good enough. If this is found to cause real life performance issues down the line then we can figure out a better solution.
15 lines
634 B
Rust
15 lines
634 B
Rust
//! Module for hashing utilities.
|
|
//!
|
|
//! Named hash_utils to prevent clashing with the std::hash module.
|
|
|
|
/// HashMap using a fast, non-cryptographic hash algorithm.
|
|
pub type FastHashMap<K, V> =
|
|
std::collections::HashMap<K, V, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
|
|
/// HashSet using a fast, non-cryptographic hash algorithm.
|
|
pub type FastHashSet<K> =
|
|
std::collections::HashSet<K, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
|
|
|
|
/// IndexMap using a fast, non-cryptographic hash algorithm.
|
|
pub type FastIndexMap<K, V> =
|
|
indexmap::IndexMap<K, V, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
|