Re: Running multiple foreach loops

2016-02-17 Thread radoburansky
Why would you expect performance degradation? On Wed, Feb 17, 2016 at 10:30 PM, Daniel Imberman [via Apache Spark User List] wrote: > Hi all, > > So I'm currently figuring out how to accumulate three separate > accumulators: > > val a:Accumulator > val b:Accumulator > val c:Accumulator > > I hav

Re: Running multiple foreach loops

2016-02-17 Thread Sabarish Sasidharan
I don't think that's a good idea. Even if it wasn't in Spark. I am trying to understand the benefits you gain by separating. I would rather use a Composite pattern approach wherein adding to the composite cascades the additive operations to the children. Thereby your foreach code doesn't have to k

Re: Running multiple foreach loops

2016-02-17 Thread Daniel Imberman
Thank you Ted! On Wed, Feb 17, 2016 at 2:12 PM Ted Yu wrote: > If the Accumulators are updated at the same time, calling foreach() once > seems to have better performance. > > > On Feb 17, 2016, at 4:30 PM, Daniel Imberman > wrote: > > > > Hi all, > > > > So I'm currently figuring out how to ac

Re: Running multiple foreach loops

2016-02-17 Thread Ted Yu
If the Accumulators are updated at the same time, calling foreach() once seems to have better performance. > On Feb 17, 2016, at 4:30 PM, Daniel Imberman > wrote: > > Hi all, > > So I'm currently figuring out how to accumulate three separate accumulators: > > val a:Accumulator > val b:Accum