[concurrency-interest] ConcurrentHashMapV8 now supports Spliterator

Doug Lea dl at cs.oswego.edu
Wed Jul 4 09:54:17 EDT 2012


On 07/04/12 09:27, Alex Lam S.L. wrote:
>> Performing parallel operations on collections that maintain
>> ordering (which is basically ignored for purposes of parallelism)
>> is usually more costly than just using a hash table (or array)
>> and then sorting (in parallel) later when the ordering is needed.
>
> In the case of frequently performing:
>
> 1) subset (range) of an ordered map
> 2) perform parallel operation on subset
> 3) ordering of elements in subset does not matter
>
> Today I just call ConcurrentSkipListMap.subMap() then perform the
> operation. Would there be an alternative which might potentially be
> more performant?

Good question. This is the opposite of the case I was
alluding to (i.e., keep in CHM, sort only when needed,
vs keep in CSLM, perform parallel ops only when needed).
Considering that the extended version of ConcurrentSkipListMap
doesn't exist yet, it's too early to tell. You'd like to avoid
the sequential bottleneck and space overhead of copying a lot
of elements from one collection to another (although there is
some room for parallelism). It may be the case that next version
of ConcurrentSkipListMap will be able to internally streamline
the equivalent of cslm.subMap(...).forEach(...) etc.

-Doug


More information about the Concurrency-interest mailing list