[jboss-dev-forums] [Design of JBossCache] - Re: Possible optimization of CachedSetImpl
genman
do-not-reply at jboss.com
Tue Nov 7 13:17:26 EST 2006
1. I actually don't know the difference ... I may have copied that from the original implementation. The tests seemed to pass. What's the sematic difference?
2. I'm not sure how this would work better?
The need for offsetting the hash code is to deal with a typically rare edge condition. If the hash function is reasonably distributed, then the chances of hash code collision (and therefore the need to do the hash code+1 trick) would be at best 1 in 2^32 and likely only a few orders of magnitude worse otherwise.
I think people expect hash collisions would happen more often, but that's because in ordinary hash tables, collisions happen from evaluating (hash code % some small number).
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3983871#3983871
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3983871
More information about the jboss-dev-forums
mailing list