[ 
https://issues.apache.org/jira/browse/HADOOP-3383?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12703690#action_12703690
 ] 

Shevek commented on HADOOP-3383:
--------------------------------

bq. the whole 17/37 stuff comes from effective Java (page 37)

I believe my response in Hadoop-5272 explains why this is at least as much 
superstition as anything. It was particularly fashionable in around 1997 when 
the first drafts of many of these books were being written, but Sun have since 
rewritten many of the libraries which call hashCode to use superior Mersenne 
algorithms for distribution. You need only ensure that your hashCodes are 
generally distinct, rather than attempting to spread them out modulo some 
(assumed smallish) N.

> Redundant computation in hashCode() implemenation
> -------------------------------------------------
>
>                 Key: HADOOP-3383
>                 URL: https://issues.apache.org/jira/browse/HADOOP-3383
>             Project: Hadoop Core
>          Issue Type: Improvement
>          Components: dfs
>            Reporter: Tsz Wo (Nicholas), SZE
>
> In some hashCode() implementation (e.g. Block.hashCode()), the formula has 
> the form
> {noformat}
> 37 * 17 + f(x),
> {noformat}
> 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.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to