[concurrency-interest] CHMv8 and Bulk update operations.

Kasper Nielsen kasperni at gmail.com
Mon Aug 26 07:22:16 EDT 2013


I actually use the forEachKey (forEachEntry for removing) approach now.

But, for some reason, I assumed I would get some speedup with custom
operations for bulk updating.
Because you only need to take the lock of a bin one time instead of every
time you process a node in that bin.

But I can see by looking at the code that we only have more than more node
in a bin around 10 % of the time
(given random hash codes). So I guess the speedup would be negligible.

- Kasper

On Mon, Aug 26, 2013 at 12:24 PM, Doug Lea <dl at cs.oswego.edu> wrote:

> On 08/24/2013 01:16 PM, Kasper Nielsen wrote:
>
>> Hi,
>>
>> I've been wondering why there aren't any bulk parallel update operations
>> such as:
>>
>> void removeAll(BiPredicate<K,V>)
>> void computeAll(BiFunction<K,V,V>)
>>
>> in CHMv8. (replaceAll is serial and does not allow removes)
>> I have been needing them a couple of times.
>> Technical issues?
>>
>>
> There is no java.util.Stream API for Pairs, Map.Entries, or any
> other compound type. But CHM has a secondary parallel API
> to handle these cases. For example, you could do
>  chm.forEachKey(1, (k) -> pred(k) ? k : null, (k) -> remove(k));
> This secondary API is sometimes a little awkward to use, but
> gives you complete control.
>
> -Doug
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20130826/d334c7a3/attachment.html>


More information about the Concurrency-interest mailing list