perf(cores): run the submitting thread's helpers at its priority
The submitting thread runs above normal, but the threads it waits for (the wide pool, the landing pools, heap records, the heap pass beside the lists) ran at normal priority, level with the title's threads and the list translators. On a six-core CPU they were often not running while it waited. VICTORY_HELPER_PRIORITY (on unless 0, VICTORY_AB can flip it) raises them to above normal. A/B in one run on an i5-12400F with an RTX 3060 (run10, Series S at 540p, off / on): 8.6 / 9.6 fps, refreshes 23.1 / 17.6 ms a frame, waiting for heap records 6.2 / 2.5 ms, card idle behind the submitting thread 24.7 / 13.2 ms. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
5 files changed
+62
-1
No files matched your search
@@ -250,6 +250,8 @@ impl Pool {
|
||||
}
|
||||
|
||||
fn help(&self) {
|
||||
// (The thread that calls `each` waits for this one's share.)
|
||||
let mut priority = crate::cores::Priority::new();
|
||||
let mut state = self.state();
|
||||
loop {
|
||||
let Some((work, i)) = take(&mut state) else {
|
||||
@@ -262,6 +264,7 @@ impl Pool {
|
||||
// SAFETY: counted in `running`, so `each` has not returned.
|
||||
let ran = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| unsafe { (*work.0)(i) }));
|
||||
working.end();
|
||||
priority.keep();
|
||||
state = self.state();
|
||||
state.running -= 1;
|
||||
state.panicked |= ran.is_err();
|
||||
|
||||
Reference in new issue
Block a user