You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Naga uses these types for nearly all the hash functions in the crate:
/// Hash map that is faster but not resilient to DoS attacks.
pub type FastHashMap<K, T> = rustc_hash::FxHashMap<K, T>;
/// Hash set that is faster but not resilient to DoS attacks.
pub type FastHashSet<K> = rustc_hash::FxHashSet<K>;
/// Insertion-order-preserving hash set (`IndexSet<K>`), but with the same
/// hasher as `FastHashSet<K>` (faster but not resilient to DoS attacks).
pub type FastIndexSet<K> =
indexmap::IndexSet<K, std::hash::BuildHasherDefault<rustc_hash::FxHasher>>;
These type aliases replace the standard library's hash function, designed to make std::collections::HashMap and HashSet resistant to denial-of-service attacks, with faster, more predictable hash functions.
This may not be the right tradeoff for Firefox. We should benchmark to see how much it would cost to just std::collections' default settings, and if the cost is minor, we should make FxHasher an option. (If the cost is minor enough, we should just drop FxHasher altogether...)
Naga uses these types for nearly all the hash functions in the crate:
These type aliases replace the standard library's hash function, designed to make
std::collections::HashMap
andHashSet
resistant to denial-of-service attacks, with faster, more predictable hash functions.This may not be the right tradeoff for Firefox. We should benchmark to see how much it would cost to just
std::collections
' default settings, and if the cost is minor, we should makeFxHasher
an option. (If the cost is minor enough, we should just dropFxHasher
altogether...)See also: #2498
The text was updated successfully, but these errors were encountered: