Re: Demo for Parallel Core Collection API

2014-02-04 Thread Paul Sandoz
On Feb 4, 2014, at 2:58 AM, Tristan Yan wrote: > Hi Paul > I know this may be a little bit late. Yes, likely too late... (see below). > But I am still asking you review this. > > http://cr.openjdk.java.net/~tyan/JDK-8033358/webrev.01/ > > This is a whole demo code include the stream demo code

Re: Demo for Parallel Core Collection API

2014-01-14 Thread Paul Sandoz
Hi Tristan, See below for a patch. The location of the code seems a little out of place with the other code. I would have expected a structure such as: stream/parallel/*.java where the source code is in the default no-package. I am not yet convinced of the value of the RandomPrimeNumber exa

Re: Demo for Parallel Core Collection API

2013-12-20 Thread Paul Sandoz
Hi Tristan, Thanks, I need to look at this in more detail, but here are some quick comments. - recommend you try and avoid using limit with parallel ops, for example the Pi example cam be reformulated as: long M = LongStream.range(0, N).parallel().filter(sr -> { double x = Thr

Re: Demo for Parallel Core Collection API

2013-12-19 Thread Tristan Yan
Hi Paul And Everyone Sorry for getting back late. I took Paul's suggestion and have written other two demos which presents usage of parallel computation. One is using Monte-Carlo to calculate value of PI. Other is find a big prime by given length. Please review it. http://cr.openjdk.java.net/~ty

Re: Demo for Parallel Core Collection API

2013-10-17 Thread Paul Sandoz
Hi, I notice in some grouping by cases that it appears as if you want to stream downstream. Here is a simple example (not very interesting but it gets the point across): /** * A downstream collector that streams elements to a further downstream * collector. */ public stat

Re: Demo for Parallel Core Collection API

2013-10-15 Thread Paul Sandoz
On Oct 15, 2013, at 4:35 PM, Tristan Yan wrote: > Hi Paul > you have comments "suggest that all streams are sequential. There is an > inconsistency in the use and in some cases it is embedded in other stream > usages." > > We do not really understand what exactly is meant, could you elaborate

Re: Demo for Parallel Core Collection API

2013-10-15 Thread Paul Sandoz
On Oct 15, 2013, at 4:20 PM, Tristan Yan wrote: > Thank you Paul > > There is one minor question, I can't compile one of your code, then I > realized that's because grouping by signature is public static >Collector> groupingBy(Function > classifier, Collector downstream) > > Which make

Re: Demo for Parallel Core Collection API

2013-10-14 Thread Paul Sandoz
Hi, Some high-level points first: - try and use static import where possible. - suggest that all streams are sequential. There is an inconsistency in the use and in some cases it is embedded in other stream usages. - "ParallelCore" is not a very descriptive name. Suggest "streams". - suggest

Re: Demo for Parallel Core Collection API

2013-10-14 Thread Alan Bateman
On 14/10/2013 04:27, Tristan Yan wrote: Hi all Could you please help to review the demo code for parallel core collection API? http://cr.openjdk.java.net/~pzhang/Tristan/8023555/webrev/ A drive-by comment/question (I have not studied the code in the webrev) but are you planning to include a