monkeyboy123 commented on code in PR #46705:
URL: https://github.com/apache/spark/pull/46705#discussion_r1610987703


##########
core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala:
##########
@@ -328,16 +328,15 @@ private[spark] object TaskMetrics extends Logging {
    */
   def fromAccumulators(accums: Seq[AccumulatorV2[_, _]]): TaskMetrics = {
     val tm = new TaskMetrics
-    for (acc <- accums) {
+    val (innerAccums, externalAccums) = accums.

Review Comment:
   Hmm, I does not understand what you mean? tm.nameToAccums is a fixed size
    LinkedHashMap, why do we need create another local variable?Did I miss 
something else?
   



##########
core/src/main/scala/org/apache/spark/executor/TaskMetrics.scala:
##########
@@ -328,16 +328,15 @@ private[spark] object TaskMetrics extends Logging {
    */
   def fromAccumulators(accums: Seq[AccumulatorV2[_, _]]): TaskMetrics = {
     val tm = new TaskMetrics
-    for (acc <- accums) {
+    val (innerAccums, externalAccums) = accums.

Review Comment:
   > Should we extract a local variable `val nameToAccums = tm.nameToAccums`? 
`tm.nameToAccums` is lazy and frequent access may have some cost.
   
   Hmm, I does not understand what you mean? tm.nameToAccums is a fixed size
    LinkedHashMap, why do we need create another local variable?Did I miss 
something else?
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to