Merge pull request #1179 from ludovic111/perf/render-thread-ahead

🤖 Agent: merged after integration wave 2 on the desktop (integ/w2 @ 38307d15 = main c16b41ab + this wave): fmt, clippy -D warnings, workspace + launcher + telemetry-server tests, release build and every affected parity harness pass; the 3 harness failures and the panel test passed on rerun (known flakes).
This commit is contained in:
Ludovic Marie
2026-10-22 15:11:03 +02:00
committed by GitHub
2 changed files with 12 additions and 4 deletions
+7
View File
@@ -12807,6 +12807,13 @@ pub fn run() -> Result<()> {
if options.dedicated.is_some() {
// Before any worker starts: on Linux they go behind the server thread.
horizon_threads::put_helpers_behind();
} else {
// The render thread, like the server thread, ahead of the workers on
// macOS and Windows. While terrain loads, the worker pools (two with
// single player's server thread) and other programs outnumber the
// cores, and a frame that gave its core up (in a GPU submit) waited
// 10 to 200 ms to get one back.
horizon_threads::favour_current();
}
let started = Instant::now();
horizon_client::spans::enable(options.spikes.is_some());
+5 -4
View File
@@ -7,10 +7,11 @@ use std::sync::atomic::{AtomicBool, Ordering};
/// threads, as vanilla's `MinecraftServer.spin` does for its server thread
/// (`Thread.setPriority(8)` when there are more than four processors), so
/// world generation and chunk encoding on every other core don't hold a tick
/// back: user-interactive quality of service on macOS, above-normal priority
/// on Windows. Nothing elsewhere: Linux lets an unprivileged thread lower its
/// priority but not raise it (and the JVM leaves it there too). Whether the
/// OS took it.
/// back (the client asks the same for its render thread, so they don't hold
/// a frame back either): user-interactive quality of service on macOS,
/// above-normal priority on Windows. Nothing elsewhere: Linux lets an
/// unprivileged thread lower its priority but not raise it (and the JVM
/// leaves it there too). Whether the OS took it.
pub fn favour_current() -> bool {
if std::thread::available_parallelism().map_or(1, |n| n.get()) <= 4 {
return false;