yaooqinn commented on code in PR #46894:
URL: https://github.com/apache/spark/pull/46894#discussion_r1630592867
##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/ExternalCatalogUtils.scala:
##########
@@ -63,22 +63,26 @@ object ExternalCatalogUtils {
bitSet
}
- def needsEscaping(c: Char): Boolean = {
+ @inline private final def needsEscaping(c: Char): Boolean = {
Review Comment:
Hi @JoshRosen I didn't get a positive benchmark result with your version on
my local labtop
```
================================================================================================
Escape
================================================================================================
OpenJDK 64-Bit Server VM 17.0.10+0 on Mac OS X 14.5
Apple M2 Max
Escape Tests: Best Time(ms) Avg Time(ms)
Stdev(ms) Rate(M/s) Per Row(ns) Relative
------------------------------------------------------------------------------------------------------------------------
Legacy 6085 6214
118 0.2 6084.6 1.0X
Kent 4849 4999
106 0.2 4849.2 1.3X
Josh 5536 5662
67 0.2 5536.0 1.1X
```
The benchmark I ran was
```scala
package org.apache.spark.sql
import org.apache.spark.benchmark.{Benchmark, BenchmarkBase}
import org.apache.spark.sql.catalyst.catalog.ExternalCatalogUtils
object EscapeBenchmark extends BenchmarkBase {
override def runBenchmarkSuite(mainArgs: Array[String]): Unit = {
val N = 1000000
runBenchmark("Escape") {
val benchmark = new Benchmark("Escape Tests", N, 10, output = output)
val paths = Seq(
"https://issues.apache.org/jira/browse/SPARK-48551",
"https...issues.apache.org/jira/browse/SPARK-48551",
"https...issues.apache.org.jira/browse/SPARK-48551",
"https...issues.apache.org.jira.browse/SPARK-48551",
"https...issues.apache.org.jira.browse.SPARK-48551")
benchmark.addCase("Legacy") { _ =>
(1 to N).foreach(_ => {
paths.foreach(ExternalCatalogUtils.escapePathNameLegacy)
})
}
benchmark.addCase("Kent") { _ =>
(1 to N).foreach(_ => {
paths.foreach(ExternalCatalogUtils.escapePathName)
})
}
benchmark.addCase("Josh") { _ =>
(1 to N).foreach(_ => {
paths.foreach(ExternalCatalogUtils.escapePathName2)
})
}
benchmark.run()
}
}
}
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]