Skip to content

Commit

Permalink
perf: Reduce default async thread count (#18142)
Browse files Browse the repository at this point in the history
  • Loading branch information
nameexhaustion authored Aug 12, 2024
1 parent a3eef6d commit 13ff0e9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion crates/polars-io/src/pl_async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,16 @@ pub struct RuntimeManager {

impl RuntimeManager {
fn new() -> Self {
let n_threads = std::env::var("POLARS_ASYNC_THREAD_COUNT")
.map(|x| x.parse::<usize>().expect("integer"))
.unwrap_or((POOL.current_num_threads() / 4).clamp(1, 4));

if polars_core::config::verbose() {
eprintln!("Async thread count: {}", n_threads);
}

let rt = Builder::new_multi_thread()
.worker_threads(std::cmp::max(POOL.current_num_threads(), 4))
.worker_threads(n_threads)
.enable_io()
.enable_time()
.build()
Expand Down

0 comments on commit 13ff0e9

Please sign in to comment.