DirectStorage: VICTORY_DSTORAGE_WORKERS sets how many workers

One for each logical processor as before when unset. On the RTX 5060 PC
(16 logical) with thread priorities in effect, 6 made no difference
(108 against 104-106 ms a frame): kept as a switch for smaller PCs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Hasusmogus
2026-11-26 22:23:06 +01:00
parent 8ea1e7bb01
commit cfa58ceabd

View File

@ -632,7 +632,14 @@ fn scheduler() -> Option<&'static Scheduler> {
})
.as_ref()?;
STARTED.call_once(|| {
let workers = std::thread::available_parallelism().map_or(4, |n| n.get());
// `VICTORY_DSTORAGE_WORKERS=<n>` (1-64): that many; else one for each
// logical processor, as before. They inflate and decode what the
// title streams, beside its own threads on the same cores.
let workers = std::env::var("VICTORY_DSTORAGE_WORKERS")
.ok()
.and_then(|v| v.trim().parse::<usize>().ok())
.map(|n| n.clamp(1, 64))
.unwrap_or_else(|| std::thread::available_parallelism().map_or(4, |n| n.get()));
let started = (0..workers)
.filter(|i| {
std::thread::Builder::new()