[PR #593] [CLOSED] Defer block behaviour loading beyond the title screen #2659

Closed
opened 2026-11-02 15:58:00 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/593
Author: @rdbtCVS
Created: 10/16/2026
Status: ❌ Closed

Base: main ← Head: perf/defer-behaviours-main-menu


📝 Commits (4)

  • 00c8023 Defer block behaviour loading until world entry
  • 7ccd765 Synchronize concurrent deferred behaviour readiness checks
  • 492a33f Support offscreen and world startup profiling
  • fb5fa90 Measure actual title first frame and gate world profiling on gameplay

📊 Changes

3 files changed (+241 additions, -5 deletions)

View changed files

📝 crates/horizon-client/src/game.rs (+151 -5)
📝 crates/horizon-client/src/game/remote.rs (+1 -0)
➕ tools/profile_client_startup.py (+89 -0)

📄 Description

Behaviours::load previously ran synchronously before the main menu, delaying startup by roughly 1,013 ms in the motivating loader profile. The client now starts behaviour preparation on a background thread using the selected resource-pack/mod root and registry, and resolves it before local world simulation, integrated or remote multiplayer, dedicated servers, and simulation fixtures.

DeferredBehaviours shares the result using OnceLock::get_or_init, so simultaneous world-entry attempts wait for the same worker result, including loader errors or panics. The task owns the resource registry Arc until loading finishes. This preserves the selected block behaviour data without a new cache format.

tools/profile_client_startup.py now supports repeated title-screen startup, --world first-playable-frame runs, --vscreen, --offscreen, --cwd and JSON result files. It uses the actual logged first rendered frame for the menu. World-entry timing uses the smoke report emitted after the first playable frame (an upper bound including exit overhead); failed or incomplete launches are excluded from results. By default each run uses a clean temporary working directory; use --cwd to exercise installed packs/mods and existing options.

Validation:

  • cargo test --offline -p horizon-client --bin horizon-client: 58 passed, 0 failed, 1 optional benchmark ignored (includes repeatable failure, concurrent readiness and worker-panic regression tests).
  • cargo test --offline -p horizon-world --lib: 87 passed, 0 failed.
  • cargo check --offline -p horizon-client: passed.
  • cargo build --offline --release -p horizon-client --bin horizon-client: passed.
  • cargo fmt --all -- --check, git diff --check, Python py_compile, profiler CLI checks: passed.

Startup profiling and limitation:

  • Existing baseline release binary, prepared 26.3 resources, xvfb-run: Vulkan initialized the RTX 4060 but then failed with Parent device is lost before the first frame.
  • Baseline using WGPU_BACKEND=gl: failed surface creation before first frame.
  • Baseline using --offscreen: same Vulkan device-loss failure.
  • Newly built optimized release binary using --offscreen: same Vulkan device-loss failure before first frame.
  • There is no valid paired first-frame, main-menu, or first-playable-frame measurement on this host and no measured startup gain is claimed. The requested comparative benchmark still needs a working graphics device or software Vulkan implementation. The change may contend with other startup CPU work, and immediate world entry may wait for background preparation.

The PR remains draft pending trustworthy comparative end-to-end timings; current CI status should be checked on the latest commit.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/horizon-rust/horizon/pull/593 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/16/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `perf/defer-behaviours-main-menu` --- ### 📝 Commits (4) - [`00c8023`](https://github.com/horizon-rust/horizon/commit/00c8023f9412a61cd05e7002a4ea192e0ea86ddf) Defer block behaviour loading until world entry - [`7ccd765`](https://github.com/horizon-rust/horizon/commit/7ccd765caf26bf7fa190d568b21a3ca11597f8ff) Synchronize concurrent deferred behaviour readiness checks - [`492a33f`](https://github.com/horizon-rust/horizon/commit/492a33fb61955d5e996045a8ea7a36491cdd2536) Support offscreen and world startup profiling - [`fb5fa90`](https://github.com/horizon-rust/horizon/commit/fb5fa90a97e9a7e0421f0a0c3bdde42c6b9c61e8) Measure actual title first frame and gate world profiling on gameplay ### 📊 Changes **3 files changed** (+241 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client/src/game.rs` (+151 -5) 📝 `crates/horizon-client/src/game/remote.rs` (+1 -0) ➕ `tools/profile_client_startup.py` (+89 -0) </details> ### 📄 Description `Behaviours::load` previously ran synchronously before the main menu, delaying startup by roughly 1,013 ms in the motivating loader profile. The client now starts behaviour preparation on a background thread using the selected resource-pack/mod root and registry, and resolves it before local world simulation, integrated or remote multiplayer, dedicated servers, and simulation fixtures. `DeferredBehaviours` shares the result using `OnceLock::get_or_init`, so simultaneous world-entry attempts wait for the same worker result, including loader errors or panics. The task owns the resource registry `Arc` until loading finishes. This preserves the selected block behaviour data without a new cache format. `tools/profile_client_startup.py` now supports repeated title-screen startup, `--world` first-playable-frame runs, `--vscreen`, `--offscreen`, `--cwd` and JSON result files. It uses the actual logged first rendered frame for the menu. World-entry timing uses the smoke report emitted after the first playable frame (an upper bound including exit overhead); failed or incomplete launches are excluded from results. By default each run uses a clean temporary working directory; use `--cwd` to exercise installed packs/mods and existing options. Validation: - `cargo test --offline -p horizon-client --bin horizon-client`: **58 passed, 0 failed, 1 optional benchmark ignored** (includes repeatable failure, concurrent readiness and worker-panic regression tests). - `cargo test --offline -p horizon-world --lib`: **87 passed, 0 failed**. - `cargo check --offline -p horizon-client`: passed. - `cargo build --offline --release -p horizon-client --bin horizon-client`: passed. - `cargo fmt --all -- --check`, `git diff --check`, Python `py_compile`, profiler CLI checks: passed. Startup profiling and limitation: - Existing baseline release binary, prepared 26.3 resources, `xvfb-run`: Vulkan initialized the RTX 4060 but then failed with `Parent device is lost` before the first frame. - Baseline using `WGPU_BACKEND=gl`: failed surface creation before first frame. - Baseline using `--offscreen`: same Vulkan device-loss failure. - Newly built optimized release binary using `--offscreen`: same Vulkan device-loss failure before first frame. - **There is no valid paired first-frame, main-menu, or first-playable-frame measurement on this host and no measured startup gain is claimed.** The requested comparative benchmark still needs a working graphics device or software Vulkan implementation. The change may contend with other startup CPU work, and immediate world entry may wait for background preparation. The PR remains draft pending trustworthy comparative end-to-end timings; current CI status should be checked on the latest commit. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 15:58:00 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
horizon-rust/horizon#2659
No description provided.