Should you cache hash values even for trivial classes? – Daniel Lemire's blog
I should add that Java's hash tables re-hash the hash values that we provide, so the benefits of the cached hash value are less than they could be.
Moreover, Strings have cached hash values by default in Java. I'm definitively not the first to notice that caching hash values can be valuable.
Read full article from Should you cache hash values even for trivial classes? – Daniel Lemire's blog
No comments:
Post a Comment