You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "Steve Loughran (JIRA)" <ji...@apache.org> on 2008/08/09 00:14:46 UTC

[jira] Commented: (HADOOP-3383) Redundant computation in hashCode() implemenation

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

Steve Loughran commented on HADOOP-3383:
----------------------------------------

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(x)), but the braces were left out. Even then, I don't know whether is beneficial or just some form of superstition.

> 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.