[GitHub] [spark] LuciferYang commented on a diff in pull request #37940: [SPARK-40494][CORE][SQL][ML][MLLIB] Optimize the performance of `keys.zipWithIndex.toMap` code pattern

2022-09-21 Thread GitBox


LuciferYang commented on code in PR #37940:
URL: https://github.com/apache/spark/pull/37940#discussion_r976077415


##
core/src/main/scala/org/apache/spark/util/collection/Utils.scala:
##
@@ -79,6 +79,20 @@ private[spark] object Utils {
 builder.result()
   }
 
+  /**
+   * Same function as `keys.zipWithIndex.toMap`, but has perf gain.
+   */
+  def toMap[K](keys: Iterable[K]): Map[K, Int] = {

Review Comment:
   GA passed



-- 
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



[GitHub] [spark] LuciferYang commented on a diff in pull request #37940: [SPARK-40494][CORE][SQL][ML][MLLIB] Optimize the performance of `keys.zipWithIndex.toMap` code pattern

2022-09-20 Thread GitBox


LuciferYang commented on code in PR #37940:
URL: https://github.com/apache/spark/pull/37940#discussion_r976000233


##
core/src/main/scala/org/apache/spark/util/collection/Utils.scala:
##
@@ -79,6 +79,20 @@ private[spark] object Utils {
 builder.result()
   }
 
+  /**
+   * Same function as `keys.zipWithIndex.toMap`, but has perf gain.
+   */
+  def toMap[K](keys: Iterable[K]): Map[K, Int] = {

Review Comment:
   
[405c625](https://github.com/apache/spark/pull/37940/commits/405c6252893c0df6cdf57cea8da94d1ebe7f56c4)
 fix this, waiting ci



-- 
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



[GitHub] [spark] LuciferYang commented on a diff in pull request #37940: [SPARK-40494][CORE][SQL][ML][MLLIB] Optimize the performance of `keys.zipWithIndex.toMap` code pattern

2022-09-20 Thread GitBox


LuciferYang commented on code in PR #37940:
URL: https://github.com/apache/spark/pull/37940#discussion_r975997057


##
core/src/main/scala/org/apache/spark/util/collection/Utils.scala:
##
@@ -79,6 +79,20 @@ private[spark] object Utils {
 builder.result()
   }
 
+  /**
+   * Same function as `keys.zipWithIndex.toMap`, but has perf gain.
+   */
+  def toMap[K](keys: Iterable[K]): Map[K, Int] = {

Review Comment:
   ok



-- 
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