Performance regression with IntStream.parallel.sum?

Paul Sandoz paul.sandoz at oracle.com
Mon Oct 28 10:04:17 PDT 2013


On Oct 28, 2013, at 6:01 PM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:

> On Oct 28, 2013, at 5:15 PM, Paul Sandoz <Paul.Sandoz at oracle.com> wrote:
>> 
>>> 
>>> Hmmm. Quite strange. Have to evaluate it.
>>> 
>> 
>> Doh <thump> head hits desk. I forgot that vm flags were not propagated via the options builder to the forked java process:
>> 
>>                .jvmArgs("-XX:-TieredCompilation -Dbenchmark.n=" + n)
>> 
>> grrr... sorry for the noise. Re-running...
>> 
> 
> N = 100_000
> Benchmark                         Mode Thr    Cnt  Sec         Mean   Mean error    Units
> l.StreamSumTest.testStreamPar     avgt   1    100    1       39.105        0.317    us/op
> l.StreamSumTest.testStreamSeq     avgt   1    100    1      486.373        1.516    us/op
> 
> 
> N = 1_000_000
> Benchmark                         Mode Thr    Cnt  Sec         Mean   Mean error    Units
> l.StreamSumTest.testStreamPar     avgt   1    100    1      174.094        8.515    us/op
> l.StreamSumTest.testStreamSeq     avgt   1    100    1     4877.512       18.542    us/op
> 
> 
> Now i am suspicious of the sequential numbers :-) While i would like to believe them my laptop has only eight hardware threads so 12x and 28x speed ups are highly suspicious.
> 
> When looking at the sequential iterations (see below) i notice a slow down which kicks in after a number of iterations (perhaps proportional N) and i observed the same effect with your test program, the benchmark results for which are:
> 

Sent too soon... i forgot to say i modified your program to remove the capture in the lambdas passed to the map, thus making it equivalent to my test.

Paul.


More information about the lambda-dev mailing list