blaginin commented on code in PR #21084:
URL: https://github.com/apache/datafusion/pull/21084#discussion_r2968035194


##########
datafusion/common/src/utils/mod.rs:
##########
@@ -923,10 +923,15 @@ pub fn combine_limit(
 ///
 /// This is a wrapper around `std::thread::available_parallelism`, providing a 
default value
 /// of `1` if the system's parallelism cannot be determined.
+///
+/// The result is cached after the first call.
 pub fn get_available_parallelism() -> usize {
-    available_parallelism()
-        .unwrap_or(NonZero::new(1).expect("literal value `1` shouldn't be 
zero"))
-        .get()
+    static PARALLELISM: LazyLock<usize> = LazyLock::new(|| {

Review Comment:
   
![telegram-cloud-photo-size-2-5328039229025621418-w](https://github.com/user-attachments/assets/39a411ad-38ec-4d8d-a6ff-c7f04aeee4f1)
   
   when running on linux, this function is constantly running



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

Reply via email to