[concurrency-interest] ConcurrentHashMap bulk parallel operations

Doug Lea dl at cs.oswego.edu
Tue Aug 14 10:11:26 EDT 2012


On 08/14/12 09:59, Tim Peierls wrote:
> On Tue, Aug 14, 2012 at 9:44 AM, Doug Lea <dl at cs.oswego.edu
> <mailto:dl at cs.oswego.edu>> wrote:
>
>     * While preliminary performance checks are promising, beware that
>     the very first parallel task execution time can be terrible.
>     Really terrible. A lot of code needs compiling, threads
>     need to  be constructed, memory needs to be reserved, etc,
>     to get going. Hopefully some of this will improve.
>
>
> First for the JVM? for the CHM classloader? for the CHM instance?
>

The worst case is for "All of the above". Others generally less so.
Here's an example run of an in-progress test program that just
computes sums in different ways in a CHM with about 10M elements:

Sequential:
   time:    1.331
First parallel run:
   time:    8.189
Next few runs:
   time:    0.064
   time:    0.064
   time:    0.047
   time:    0.044
...
(stays around the same time from there)
Now switch to a different (more expensive) sum function:
   time:    1.214
   time:    0.080
   time:    0.075
...


-Doug


More information about the Concurrency-interest mailing list