Details

Type: Improvement

Status: Closed

Priority: Major

Resolution: Fixed

Affects Version/s: None

Fix Version/s: 0.21.0

Component/s: None

Labels:None

Hadoop Flags:Incompatible change, Reviewed
Description
In some hashCode() implementation (e.g. Block.hashCode()), the formula has the form
37 * 17 + f(x),
where f( x ) is some function. Adding 37*17 to f( x ) shifts the value of f( x ). It is not effective to do shifting in hash functions. The computation is redundant.
Issue Links
 is related to

HADOOP5727 Faster, simpler id.hashCode() which does not allocate memory
 Closed
the whole 17/37 stuff comes from effective Java (page 37 , and some of the IDEs implement the feature, so its become quite common:
http://www.google.com/codesearch?hl=en&q=+lang:java+%5C*37&start=20&sa=N
Maybe the goal was to have 37 * (17 + f), but the braces were left out. Even then, I don't know whether is beneficial or just some form of superstition.