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

Christian Fries email at christian-fries.de
Thu May 15 17:55:03 EDT 2014

Dear Paul.

Am 15.05.2014 um 09:50 schrieb Paul Sandoz <paul.sandoz at oracle.com>:
>  JMH is a Java harness for building, running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targetting the JVM.
> i.e. M can be "Micro" | "Macro" or generally "Measurement"

Thank you very much. I have overlooked that. JMH is a great tool. I have created the JMH benchmark (just added the annotations), they look the same.

Benchmark                                                                           Mode   Samples         Mean   Mean error    Units
o.s.NestedParallelForEachTest.timeNestedLoopWithInnerSequential                   sample        20       26,901        0,690     s/op	(<--- outer loop parallel, inner loop sequencial)
o.s.NestedParallelForEachTest.timeNestedLoopWithInnerParallel                     sample        20       35,120        2,852     s/op	(<--- outer loop parallel, inner loop parallel)
o.s.NestedParallelForEachTest.timeNestedLoopWithInnerParallelButWrappedInThread   sample        20       26,817        0,380     s/op	(<--- outer loop parallel, inner loop parallel + workaround fix)

Note: Something which I could not capture with JMH, but which my handmade test prints out is the number of threads involved and the CPU time used. The „unfixed“ version is 30% slower AND burnes 60%-100% more process cpu time. (Can JMH monitore cpu time? (I did not find that) - If not, this is maybe a nice feature request).


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20140515/5738c3e1/attachment.html>

More information about the Concurrency-interest mailing list