Open tgross35 opened 1 year ago
Thank you for the issue! In general, this crate strives to be minimalistic and independent, and adding dependencies would go against this philosophy. However, it would be appropriate to abstract away which struct is used for storing attributes via a trait so that one can implement that trait for anything else elsewhere.
It seems like internally,
Attributes
is astd::collections::HashMap
. Would it be possible to usehashbrown::HashMap
? Probably behind a Cargo flag to makehashbrown
an optional dependency.Reasoning: the
HashMap
in collections is extremely collision resistant (SipHash), but this means it is slower and has a larger per-entry memory overhead than alternatives.hashbrown
usesahash
which is much faster and has a smaller per-entry overhead (1/8 the size if I recall correctly).ahash
is not as collision resistant, but this is highly unlikely to be exploitable for this use case.All the functions taking
DefaultHasher
would need to become generic.Alternatively, using
ahash
directly without going throughhashbrown
would provide the same results.