[concurrency-interest] ForkJoinPool not designed for nested Java 8 streams.parallel().forEach( ... )

Russel Winder russel at winder.org.uk
Tue May 6 04:12:36 EDT 2014


On Tue, 2014-05-06 at 00:50 +0400, Aleksey Shipilev wrote:
[…]
> To my knowledge of FJP mechanics, this should work perfectly well, since
> submitters from the external loop will participate in the computation
> and making progress. My throw-away tests, like:
> 
>     @GenerateMicroBenchmark
>     public void test(BlackHole bh) {
>         IntStream.range(0, TASKS).parallel().forEach(i -> {
>             IntStream.range(0, TASKS).parallel().forEach(j -> {
>                 bh.consume(i + j);
>             });
>         });
>     }
> 
> ...do not manage to deadlock.
[…]

I am finding that whilst nested streams code works, it seems to have
dreadful performance. I need to do more work, and get proper benchmark
data, before making an serious claim on this, for now it is just an
anecdotal indicator. 
-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder at ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel at winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder



More information about the Concurrency-interest mailing list