[concurrency-interest] ConcurrentHashMapV8

Doug Lea dl at cs.oswego.edu
Tue Aug 30 20:28:55 EDT 2011

On 08/30/11 19:45, Nathan Reynolds wrote:
> Doug,
> I am wondering if you have data which shows how many cycles get(), put(),
> remove() and putIfAbsent() take on ConcurrentHashMapV8, ConcurrentHashMapV7,
> synchronized HashMap and unsynchronized HashMap?

No cycle counts but...

There was a bunch of mail on measuring expected hash map performance
for typical loads on the core-libs openjdk list around July 2010(?).

For single-threaded performance, people seem to believe the results of
running our MapMicroBenchmark.
(See http://gee.cs.oswego.edu/cgi-bin/viewcvs.cgi/jsr166/src/test/loops/)
For which on most machines, CHMV8 is about 3% faster than CHMV7,
and 10-25% slower (depending on #elements) than java.util.Hashmap.
I don't have results for synchronizedMap(HashMap) handy but
java.util.Hashtable (which is about the same) is generally
slower than either version of CHM, even with biased locking
turned on.

For multi-threaded tests, there's less consensus about the
best micro-benchmark. We have a few (including MapLoops),
and there are others out there -- including one by Cliff Click.
In general CHMV8 is the best of all the concurrent hash map
implementations I've tested on tests where there is some
temporal locality of access (which is typical) but open-address
versions such as Cliff Clicks's are faster for get/put/remove-only
tests with randomized key use, mainly because of fewer cache misses.


More information about the Concurrency-interest mailing list