3 ms·
It's certainly not a bad thing, why do you think it might be?
by vbezhenar 11y ago
It's certainly not a bad thing, why do you think it might be?
- mnw21cam 11y agoIt can be a bad thing if all programmers assume that the caching works, and it doesn't. That's where the bit in the article mentions strings that produce a hash code of zero. Zero is used as a sentinel for "hash code not yet calculated", so for those particular strings the code is recalculated every single time.
- vbezhenar 11y agoThat's not worse than not caching at al. Hashing implementation usually is a black box. Actually simple if (h == 0) h = 0xdeadbeef would probably prevent that issue from happening (if that should be considered a real issue at all).