Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

power 2 hashes....

 
jay vas
Ranch Hand
Posts: 407
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI guys : I overrode hash code on a massive data set, and naively was hashing based on the first 5 chars of sequences that had over 50 letters.

you can imagine what happened next.....

I figured I'd look into the JVM and how it does hashing, and came across some interesting youtube videos on the subject.

Evidently, "Power of 2" hashing is popular.

1) I wonder why this would be better than prime hashing ? Can someone explain the difference ?
2) I also notice that "bit shifting" is popular for hash functions. Why is this ? I see alot of x = x << 5 type statements.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic