Review Request CR#7118743 : Alternative Hashing for String with Hash-based Maps

Mike Duigou mike.duigou at oracle.com
Wed May 23 17:29:22 PDT 2012


On May 23 2012, at 17:09 , Doug Lea wrote:

> 
> Note that ConcurrentHashMap has been overhauled for JDK8.
> The preliminary version, partially waiting for stability
> on lambda-related stuff, has been out a while as
> jsr166e.ConcurrenthashMapV8 (see
> http://gee.cs.oswego.edu/dl/concurrency-interest/index.html)

For the short term it will probably be a little annoying to keep this in sync between the workspaces. Sorry in advance.

> It is easy to add seeded murmur hash code to this,
> which I plan to do. One question:
> 
> Given the JDK8 conventions in your mail,
> it seems that field hashMask can never be zero,
> so doesn't need to be checked, but is in your JDK8 diffs:
>  int h = hashMask;
>  if ((0 != h) && (k instanceof String)) {
>        return ((String) k).hash32() ^ h;
> 
> ... and further simplifying a bit from there.

After Remi's feedback I looked more closely and the h != 0 check isn't needed in the JDK 8 implementation. I had been trying to keep the JDK 7 and 8 differences to a minimum and missed this. I will have this fixed in the next webrev.

> (Also "hashMask" seems like an odd name for this. "hashSeed"?)

Thinking about it more I prefer hashSeed as well. I will make this change before the next webrev.

Thanks Doug!

Mike


More information about the jdk7u-dev mailing list