JDK-7038542 : Small performace regression in ConcurrentHashMap on c1 since CR 7036559
  • Type: Bug
  • Status: Closed
  • Resolution: Fixed
  • Component: core-libs
  • Sub-Component: java.util.concurrent
  • Priority: P3
  • Affected Version: 7
  • OS: generic
  • CPU: generic
  • Submit Date: 2011-04-21
  • Updated Date: 2011-06-08
  • Resolved Date: 2011-06-08
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availabitlity Release.

To download the current JDK release, click here.
JDK 7
7 b142Fixed
Related Reports
Relates :  
Description
Small performace regression in ConcurrentHashMap on c1 since the integration of CR 7036559: "ConcurrentHashMap footprint and contention improvements".

Paraphrasing Doug's comments:

On ARM/C1, the cost of using Unsafe and the cost of a read fence seem to
both be in the 10-30ns range. Using them together combines cost. I
suspect that the Unsafe cost is actually mainly due to c1 not inlining
the little methods that encapsulate the accesses.

The solution is to manually expand out these for get(). This seems to
balance things out so that the change is performance-neutral or maybe
even a bit faster that the old-CHM, even on ARM. It is not the
first time we've done this for such reasons in collections.

The new-CHM is also 20% faster than old-CHM for #threads==1 on c1 on sparc,
so it looks like it is worth doing (mainly for get and containsKey; others
entail calls anyway). It is no faster on c2 on any machine I have, so is not
likely to make much of a difference in practice (since most systems using
CHMs much will be using c2 anyway) except in helping speed up class loading
etc a bit.

Comments
EVALUATION JDK7 Changeset: e9ec52c63a9f Author: dl Date: 2011-04-21 17:00 +0100 URL: http://hg.openjdk.java.net/jdk7/tl/jdk/rev/e9ec52c63a9f 7038542: Small performace regression in ConcurrentHashMap on c1 since CR 703655 Reviewed-by: chegar ! src/share/classes/java/util/concurrent/ConcurrentHashMap.java
2011-04-21

EVALUATION Seems like a good idea.
2011-04-21