Increase the size of the rayon pool and try to make slowjobs a little

friendlier.
This commit is contained in:
Joshua Yanovski 2022-09-07 01:34:27 -07:00
parent f17910ed2a
commit b489d1ac84
2 changed files with 7 additions and 2 deletions

View File

@ -569,6 +569,11 @@ impl SlowJobPool {
// times or something in case we have more tasks to execute).
return;
};
// Hint to scheduler to run any other threads that are currently waiting, since
// slowjobs are, well, slow :) i.e. the cost of yielding should be very small
// compared to the cost of actually running the job for *almost* every job on the
// pool (and for jobs for which this isn't true, we should probably batch them up).
std::thread::yield_now();
}
});
}

View File

@ -106,10 +106,10 @@ impl State {
GameMode::Client => "c",
GameMode::Singleplayer => "sp",
};
let rayon_threads = match game_mode {
let rayon_threads = /*match game_mode {
GameMode::Server | GameMode::Client => num_cpu / 2,
GameMode::Singleplayer => num_cpu / 4,
}/*num_cpu*/.max(common::consts::MIN_RECOMMENDED_RAYON_THREADS);
}*/num_cpu.max(common::consts::MIN_RECOMMENDED_RAYON_THREADS);
let rayon_pool = Arc::new(
ThreadPoolBuilder::new()
.num_threads(rayon_threads)