JoshRosen opened a new pull request, #50167:
URL: https://github.com/apache/spark/pull/50167

   ### What changes were proposed in this pull request?
   
   RuntimeConfig.getOption is defined as
   
   ```scala
     /** @inheritdoc */
     def getOption(key: String): Option[String] = {
       try Option(get(key)) catch {
         case _: NoSuchElementException => None
       }
     } 
   ```
   
   This uses exceptions for control flow, which can be a performance problem.
   
   This PR updates this code to use a new package-private `getConfStringOption` 
helper in order to avoid the exceptions.
   
   ### Why are the changes needed?
   
   Address a perf. problem if `getOption` for non-existing configurations is 
called at a high frequency. It's usually not a good practice to perform 
configuration lookups at a high rate (e.g in a hot method or loop), but if 
someone _does_ do that then the exceptions make the perf. issue worse.
   
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing unit tests.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   No.


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