Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-10-01 Thread Prakhar Makhija
Thanks for the material. I was looking forward to watch/read more about it
in detail.
On Oct 1, 2016 5:21 AM, "Stuart Marks"  wrote:

>
>
> On 9/30/16 12:41 PM, John Rose wrote:
>
>> On Sep 29, 2016, at 11:39 PM, Louis Wasserman 
>> wrote:
>>
>>>
>>> You should absolutely not assume parallel streams are faster than
>>> sequential streams.
>>> http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html <
>>> http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html> is pretty
>>> much
>>> the iconic document on that subject, and explains circumstances under
>>> which
>>> parallelism is good, and when it is likely to be harmful.
>>>
>>
>> Stuart Marks and Brian Goetz gave an excellent talk on this at JavaOne
>> last week.
>>
>> You can view it here.  The talk is called "Thinking in Parallel".
>> https://youtu.be/WSxKI5S8j90?t=8h51m34s > t=8h51m34s>
>>
>> InfoQ wrote a useful summary of the talk, for those with no time for
>> video:
>> https://www.infoq.com/news/2016/09/JavaOne-2016-parallel-streams <
>> https://www.infoq.com/news/2016/09/JavaOne-2016-parallel-streams>
>>
>> But the video is very enjoyable, even if you think you know what they are
>> going to say.
>>
>> — John
>>
>> P.S.  One influence of this year's presentation is an epic manifesto by
>> Guy Steele in 2010.
>> https://www.infoq.com/presentations/Thinking-Parallel-Programming <
>> https://www.infoq.com/presentations/Thinking-Parallel-Programming>
>>
>
>
> John, thanks for the plug!
>
> If you just want to look at the slides, they're linked from this post on
> my blog:
>
> https://stuartmarks.wordpress.com/2016/09/23/javaone-2016-sessions/
>
> s'marks
>


Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-30 Thread Stuart Marks



On 9/30/16 12:41 PM, John Rose wrote:

On Sep 29, 2016, at 11:39 PM, Louis Wasserman  wrote:


You should absolutely not assume parallel streams are faster than
sequential streams.
http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html 
 is pretty much
the iconic document on that subject, and explains circumstances under which
parallelism is good, and when it is likely to be harmful.


Stuart Marks and Brian Goetz gave an excellent talk on this at JavaOne last 
week.

You can view it here.  The talk is called "Thinking in Parallel".
https://youtu.be/WSxKI5S8j90?t=8h51m34s 


InfoQ wrote a useful summary of the talk, for those with no time for video:
https://www.infoq.com/news/2016/09/JavaOne-2016-parallel-streams 


But the video is very enjoyable, even if you think you know what they are going 
to say.

— John

P.S.  One influence of this year's presentation is an epic manifesto by Guy 
Steele in 2010.
https://www.infoq.com/presentations/Thinking-Parallel-Programming 




John, thanks for the plug!

If you just want to look at the slides, they're linked from this post on my 
blog:

https://stuartmarks.wordpress.com/2016/09/23/javaone-2016-sessions/

s'marks


Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-30 Thread John Rose
On Sep 29, 2016, at 11:39 PM, Louis Wasserman  wrote:
> 
> You should absolutely not assume parallel streams are faster than
> sequential streams.
> http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html 
>  is pretty much
> the iconic document on that subject, and explains circumstances under which
> parallelism is good, and when it is likely to be harmful.

Stuart Marks and Brian Goetz gave an excellent talk on this at JavaOne last 
week.

You can view it here.  The talk is called "Thinking in Parallel".
https://youtu.be/WSxKI5S8j90?t=8h51m34s 


InfoQ wrote a useful summary of the talk, for those with no time for video:
https://www.infoq.com/news/2016/09/JavaOne-2016-parallel-streams 


But the video is very enjoyable, even if you think you know what they are going 
to say.

— John

P.S.  One influence of this year's presentation is an epic manifesto by Guy 
Steele in 2010.
https://www.infoq.com/presentations/Thinking-Parallel-Programming 




Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-30 Thread Louis Wasserman
You should absolutely not assume parallel streams are faster than
sequential streams.
http://gee.cs.oswego.edu/dl/html/StreamParallelGuidance.html is pretty much
the iconic document on that subject, and explains circumstances under which
parallelism is good, and when it is likely to be harmful.

On Thu, Sep 29, 2016 at 10:07 PM Prakhar Makhija  wrote:

> The application makes a hit to a core object over and over again. I have to
> copy this object, i.e. make a clone of it using the Cloneable interface, so
> that the original object cannot be modified. But since the references of
> the old object and clone object would be intact, inside the clone method I
> am explicitly copying the List Map and Set using parrallelStream/stream.
>
> The hardware is i3 processor with 8GB RAM and 1TB hard disk.
>
> So you mean to say, Parallel Stream is good for large data set?
> On Sep 30, 2016 10:08 AM, "David Holmes"  wrote:
>
> > On 30/09/2016 2:24 PM, Prakhar Makhija wrote:
> >
> >> Hi everyone,
> >>
> >> I have started using both Stream and ParallelStream, for Set List and
> >> Entry
> >> of Map.
> >>
> >> What I can't understand is why Stream is taking lesser time than
> >> ParallelStream.
> >>
> >> Shouldnt ParallelStream be giving better performance than Stream in
> terms
> >> of Time Complexity?
> >>
> >
> > Depends on the data set size and your hardware, and what exactly you are
> > trying to do in parallel.
> >
> > David
> >
>


Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-29 Thread David Holmes

On 30/09/2016 3:07 PM, Prakhar Makhija wrote:

The application makes a hit to a core object over and over again. I have
to copy this object, i.e. make a clone of it using the Cloneable
interface, so that the original object cannot be modified. But since the
references of the old object and clone object would be intact, inside
the clone method I am explicitly copying the List Map and Set using
parrallelStream/stream.

The hardware is i3 processor with 8GB RAM and 1TB hard disk.


You only have two cores on an i3, with hyper-threading so you have very 
limited speedup potential to begin with



So you mean to say, Parallel Stream is good for large data set?


What I mean is that if the data set is too small then the overhead of 
parallelizing the work will outweigh the work itself.


David
-


On Sep 30, 2016 10:08 AM, "David Holmes" > wrote:

On 30/09/2016 2:24 PM, Prakhar Makhija wrote:

Hi everyone,

I have started using both Stream and ParallelStream, for Set
List and Entry
of Map.

What I can't understand is why Stream is taking lesser time than
ParallelStream.

Shouldnt ParallelStream be giving better performance than Stream
in terms
of Time Complexity?


Depends on the data set size and your hardware, and what exactly you
are trying to do in parallel.

David



Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-29 Thread Prakhar Makhija
The application makes a hit to a core object over and over again. I have to
copy this object, i.e. make a clone of it using the Cloneable interface, so
that the original object cannot be modified. But since the references of
the old object and clone object would be intact, inside the clone method I
am explicitly copying the List Map and Set using parrallelStream/stream.

The hardware is i3 processor with 8GB RAM and 1TB hard disk.

So you mean to say, Parallel Stream is good for large data set?
On Sep 30, 2016 10:08 AM, "David Holmes"  wrote:

> On 30/09/2016 2:24 PM, Prakhar Makhija wrote:
>
>> Hi everyone,
>>
>> I have started using both Stream and ParallelStream, for Set List and
>> Entry
>> of Map.
>>
>> What I can't understand is why Stream is taking lesser time than
>> ParallelStream.
>>
>> Shouldnt ParallelStream be giving better performance than Stream in terms
>> of Time Complexity?
>>
>
> Depends on the data set size and your hardware, and what exactly you are
> trying to do in parallel.
>
> David
>


Re: ParallelStream Vs Stream Digest, Vol 113, Issue 94

2016-09-29 Thread David Holmes

On 30/09/2016 2:24 PM, Prakhar Makhija wrote:

Hi everyone,

I have started using both Stream and ParallelStream, for Set List and Entry
of Map.

What I can't understand is why Stream is taking lesser time than
ParallelStream.

Shouldnt ParallelStream be giving better performance than Stream in terms
of Time Complexity?


Depends on the data set size and your hardware, and what exactly you are 
trying to do in parallel.


David