This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Performance and the fly likes power 2 hashes.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Performance
Bookmark "power 2 hashes...." Watch "power 2 hashes...." New topic
Author

power 2 hashes....

jay vas
Ranch Hand

Joined: Aug 30, 2005
Posts: 407
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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: power 2 hashes....
 
Similar Threads
jasper reports with subreports
MultiDimenaional Array sort
a question about if satment and the handling of && ||
what layouts to use
Duplicate keys in Hashmap returns null get("key")