You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@groovy.apache.org by Russel Winder <ru...@winder.org.uk> on 2018/01/03 18:50:49 UTC

GPars 2 Stuff

In GPars 1.X it was possible to do things such as:

    [1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}

Without GPars it is possible using Groovy to achieve the exact same
functionality on JDK8+ with:

    [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a, b)}.get()

The question is therefore whether to remove the GPars 1.X behaviour
from GPars 2.X since the functionality is available using nigh on the
same just using JDK8+ features, or to mock it up using the JDK8+
features.

Personally I am all for removing the GPars 1.X stuff from GPars 2.X,
Ockham's Razor etc., so this will be the default action unless people
get vocal and contribute. 

-- 
Russel.
==========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Re: GPars 2 Stuff

Posted by Russel Winder <ru...@winder.org.uk>.
On Wed, 2018-01-03 at 20:41 +0100, James NORTHROP wrote:
> Would second the motion to reduce redundancy where possible, as it
> reduces duplication of effort in testing, docs, etc. where, maybe, we
> can get GPars down to a core minimum of functionality, above and
> beyond what java provides; essentially as the (b)leading edge of
> concurrency.

I guess the question is how long to leave "voting" open before
declaring the motion passed nem con.

> We may reach a point where Java 1.9+ includes everything we could
> possibly provide in GPars 2.0+ thus making GPars redundant. Isn't
> that the best we could hope for ? To make the JVM realm the premier
> choice for parallel/concurrent solutions ? Just a thought.

If GPars was redundant (along with Quasar) because all the tools were
in the standard library, the JVM world would be a better place.

-- 
Russel.
==========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

re: GPars 2 Stuff

Posted by James NORTHROP <ja...@orange.fr>.
Would second the motion to reduce redundancy where possible, as it reduces duplication of effort in testing, docs, etc. where, maybe, we can get GPars down to a core minimum of functionality, above and beyond what java provides; essentially as the (b)leading edge of concurrency.

 

We may reach a point where Java 1.9+ includes everything we could possibly provide in GPars 2.0+ thus making GPars redundant. Isn't that the best we could hope for ? To make the JVM realm the premier choice for parallel/concurrent solutions ? Just a thought.

Thx

Jim

 

 

 

 

> Message du 03/01/18 19:51
> De : "Russel Winder" 
> A : "GPars Users" 
> Copie à : "Groovy_Users" 
> Objet : GPars 2 Stuff
> 
> In GPars 1.X it was possible to do things such as:
> 
> [1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}
> 
> Without GPars it is possible using Groovy to achieve the exact same
> functionality on JDK8+ with:
> 
> [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a, b)}.get()
> 
> The question is therefore whether to remove the GPars 1.X behaviour
> from GPars 2.X since the functionality is available using nigh on the
> same just using JDK8+ features, or to mock it up using the JDK8+
> features.
> 
> Personally I am all for removing the GPars 1.X stuff from GPars 2.X,
> Ockham's Razor etc., so this will be the default action unless people
> get vocal and contribute. 
> 
> -- 
> Russel.
> ==========================================
> Dr Russel Winder t: +44 20 7585 2200
> 41 Buckmaster Road m: +44 7770 465 077
> London SW11 1EN, UK w: www.russel.org.uk
> 
>
> [ signature.asc (0.8 Ko) ]

Re: GPars 2 Stuff

Posted by Russel Winder <ru...@winder.org.uk>.
On Mon, 2018-01-08 at 08:21 +0530, Balachandran Sivakumar wrote:
> Hi Dr. Russel,
> 
> On Thu, Jan 4, 2018 at 12:20 AM, Russel Winder <ru...@winder.org.uk> wrote:
> > In GPars 1.X it was possible to do things such as:
> > 
> >     [1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}
> > 
> > Without GPars it is possible using Groovy to achieve the exact same
> > functionality on JDK8+ with:
> > 
> >     [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a, b)}.get()
> > 
> 
>     The GPars way is a lot more terse and more "functional" than the
> JDK8+ way. As a user, we don't have to know whether the underlying
> stuff is a parallelStream or ParallelArray(like it is in GPars 1.x).
> So, I would prefer to retain the API, but base it over streams instead
> of ParallelArrays. Thanks

I guess it depends on the definition of "functional": in the sense "functional
programming", no Streams and the use of Optional is correct; in the sense of
"works for me" I guess it is personal choice!

-- 
Russel.
==========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Re: GPars 2 Stuff

Posted by Balachandran Sivakumar <be...@gmail.com>.
Hi Dr. Russel,

On Thu, Jan 4, 2018 at 12:20 AM, Russel Winder <ru...@winder.org.uk> wrote:
> In GPars 1.X it was possible to do things such as:
>
>     [1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}
>
> Without GPars it is possible using Groovy to achieve the exact same
> functionality on JDK8+ with:
>
>     [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a, b)}.get()
>

    The GPars way is a lot more terse and more "functional" than the
JDK8+ way. As a user, we don't have to know whether the underlying
stuff is a parallelStream or ParallelArray(like it is in GPars 1.x).
So, I would prefer to retain the API, but base it over streams instead
of ParallelArrays. Thanks



-- 
Thank you
Balachandran Sivakumar

Re: GPars 2 Stuff

Posted by Russel Winder <ru...@winder.org.uk>.
On Sun, 2018-01-07 at 09:14 -0700, Daniel Sun wrote:
> Hi Russel,
> 
>        `[1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}` is much
> groovier than ` [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a,
> b)}.get()`, so I hope the original API can be kept and its implementation
> can base on Java8's functionality.

I remain unconvinced this is the right path. However Szymon Stępniak provided
a pull request 2017-07 to begin patching GPars 2.X to have the old
ParallelArray API from GPars 1.X, and I have now committed this.

NB Given I am for removal of all the ParallelArray stuff, it is up to those
who want this feature to provide pull requests to make it work! 

-- 
Russel.
==========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Re: GPars 2 Stuff

Posted by Russel Winder <ru...@winder.org.uk>.
On Sun, 2018-01-07 at 20:38 +0100, MG wrote:
> (watching NFL playoffs, so just a quick comment)
> 
> Was thinking the same as Daniel here.
> 
> Was also wondering whether adding the groovier variety of the 
> functionality coud not be automated ? At least for the examples shown it 
> looks like this might be a good option in principal.
> AST transformation (requires IDE support), generate the Groovy sources 
> in textual form, ... ?
> 

As noted in the previous email I just merged Szymon Stępniak's pull request
from last year starting work on patching the ParallelArray stuff to work with
Streams. I will try and make the code pass it's tests so we have a green, but
after that I'll leave it up to submitted pull requests to progress that stuff.

-- 
Russel.
==========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk

Re: GPars 2 Stuff

Posted by MG <mg...@arscreat.com>.
(watching NFL playoffs, so just a quick comment)

Was thinking the same as Daniel here.

Was also wondering whether adding the groovier variety of the 
functionality coud not be automated ? At least for the examples shown it 
looks like this might be a good option in principal.
AST transformation (requires IDE support), generate the Groovy sources 
in textual form, ... ?

Cheers,
mg


On 07.01.2018 17:14, Daniel Sun wrote:
> Hi Russel,
>
>         `[1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}` is much
> groovier than ` [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a,
> b)}.get()`, so I hope the original API can be kept and its implementation
> can base on Java8's functionality.
>
> Cheers,
> Daniel.Sun
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html
>


Re: GPars 2 Stuff

Posted by Daniel Sun <re...@hotmail.com>.
Hi Russel,

       `[1, 2, 3, 4, 5].parallel.reduce{a, b -> Math.min(a, b)}` is much
groovier than ` [1, 2, 3, 4, 5].parallelStream().reduce{a, b -> Math.min(a,
b)}.get()`, so I hope the original API can be kept and its implementation
can base on Java8's functionality.

Cheers,
Daniel.Sun



--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Users-f329450.html