Why would you expect performance degradation? On Wed, Feb 17, 2016 at 10:30 PM, Daniel Imberman [via Apache Spark User List] <ml-node+s1001560n26256...@n3.nabble.com> 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 have an r:RDD[thing] and the code currently reads > > r.foreach{ > thing => > a += thing > b += thing > c += thing > } > > > Ideally, I would much prefer to split this up so that I can separate > concerns. I'm considering creating something along the lines of: > > def handleA(a:Accumulator, r:RDD[Thing]){ > //a's logic > r.foreach{ thing => a += thing} > } > > > def handleB(b:Accumulator, r:RDD[Thing]){ > //a's logic > r.foreach{ thing => b += thing} > } > > and so on. However Im worried that this would cause a performance hit. > Does anyone have any thoughts as to whether this would be a bad idea? > > thank you! > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > > http://apache-spark-user-list.1001560.n3.nabble.com/Running-multiple-foreach-loops-tp26256.html > To start a new topic under Apache Spark User List, email > ml-node+s1001560n1...@n3.nabble.com > To unsubscribe from Apache Spark User List, click here > <http://apache-spark-user-list.1001560.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=cmFkb2J1cmFuc2t5QGdtYWlsLmNvbXwxfC03MDA2NjE5MjQ=> > . > NAML > <http://apache-spark-user-list.1001560.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/Running-multiple-foreach-loops-tp26256p26260.html Sent from the Apache Spark User List mailing list archive at Nabble.com.