[concurrency-interest] CHMv8 and Bulk update operations.
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.
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:
>> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest