Add a useful comment about the RawList stable hash cache.

I tried removing it to see what happened. Not a good idea!
This commit is contained in:
Nicholas Nethercote 2026-02-04 16:55:23 +11:00
parent 09eb497396
commit e35fd451a0

View file

@ -20,6 +20,9 @@ where
T: HashStable<StableHashingContext<'a>>,
{
fn hash_stable(&self, hcx: &mut StableHashingContext<'a>, hasher: &mut StableHasher) {
// Note: this cache makes an *enormous* performance difference on certain benchmarks. E.g.
// without it, compiling `diesel-2.2.10` can be 74% slower, and compiling
// `deeply-nested-multi` can be ~4,000x slower(!)
thread_local! {
static CACHE: RefCell<FxHashMap<(*const (), HashingControls), Fingerprint>> =
RefCell::new(Default::default());