[PR #7187] [MERGED] perf: read sounds, GUI sprite metadata and the language off the F3+T frame #7398

Closed
opened 2026-11-03 06:38:57 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/7187
Author: @ludovic111
Created: 11/2/2026
Status: ✅ Merged
Merged: 11/2/2026
Merged by: @ludovic111

Base: main ← Head: perf/reload-stage


📝 Commits (1)

  • 1410a97 perf: read sounds, GUI sprite metadata and the language off the F3+T frame

📊 Changes

3 files changed (+56 additions, -7 deletions)

View changed files

📝 crates/horizon-client-render/src/audio.rs (+6 -1)
📝 crates/horizon-client-render/src/ui.rs (+13 -1)
📝 crates/horizon-client/src/game/packs.rs (+37 -5)

📄 Description

🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself.

F3+T (or any resource pack change) has one long frame: the apply step that swaps the reloaded resources in on the render thread. It also parsed every sounds.json (~15 ms), walked the GUI sprites' .mcmeta files (~3 ms) and loaded the language (~2 ms) from disk. stage_pack now reads those three on the reload worker, next to the atlas build, and the apply step only installs them:

  • Audio::reload_with(root, registry) (reload calls it with SoundRegistry::load).
  • ui::read_metadata / ui::set_metadata (load_metadata is the two in a row, unchanged for startup).
  • If the player picks another language while the reload runs, the apply step loads that language instead of the staged one, so their choice still wins.

A/B: F3+T, Mac mini M4 Pro, RD 12, 3 alternated pairs (tools/pacing_bench.py --scenarios reload, #7175)

Both builds had temporary timing laps in apply_staged_pack to break the frame down; the laps are not in this PR.

base 1 new 1 base 2 new 2 base 3 new 3 mean
F3+T worst frame (ms) 84.3 64.5 89.6 65.8 95.1 69.1 89.7 → 66.5
sounds in that frame (ms) 15.0 0 14.6 0 17.0 0.6 15.5 → 0.2
GUI metadata + language (ms) 5.9 0 5.2 0 6.0 0 5.7 → 0
renderer rebuild (ms, unchanged) 56.4 57.7 63.3 59.3 65.0 61.8 —

What remains of the frame is mostly the renderer rebuild (~60 ms), for a later PR.

pr_ready below. Its one ❌ is the horizon-client-render lib tests getting SIGSEGV under llvmpipe when run in parallel, which also happens on main. Run single-threaded on the same head (cargo test -p horizon-client-render --lib -- --test-threads=1), they pass: 1149 passed, 0 failed.

pr_ready (tools/pr_ready.py --quick on playhorizon, against origin/main at 7d0df99a7, 10 min 52 s)

Check Result
Scope ✅ 3 files, +56 −7
Cargo.lock ✅ unchanged
Public tree ✅ (1 s)
Python tests ✅ 612 passed (1 min 13 s)
rustfmt ✅ (15 s)
clippy ✅ (3 min 27 s)
tests: horizon-client, horizon-client-render ❌ 677 passed (4 min 35 s)
doc tests ✅ 0 passed (6 s)
content root tests ➖ content root untouched
mod API up to date ✅ (40 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ➖ launcher untouched
launcher clippy ➖ launcher untouched
launcher tests ➖ launcher untouched
Parity ➖ 141 affected, to run in CI (--quick): ambient_sound, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers and 129 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with Claude Code


🔄 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/7187 **Author:** [@ludovic111](https://github.com/ludovic111) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `perf/reload-stage` --- ### 📝 Commits (1) - [`1410a97`](https://github.com/horizon-rust/horizon/commit/1410a97974e0d5184b9ebb6782b76ca074b6d8ef) perf: read sounds, GUI sprite metadata and the language off the F3+T frame ### 📊 Changes **3 files changed** (+56 additions, -7 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/audio.rs` (+6 -1) 📝 `crates/horizon-client-render/src/ui.rs` (+13 -1) 📝 `crates/horizon-client/src/game/packs.rs` (+37 -5) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. F3+T (or any resource pack change) has one long frame: the apply step that swaps the reloaded resources in on the render thread. It also parsed every `sounds.json` (~15 ms), walked the GUI sprites' `.mcmeta` files (~3 ms) and loaded the language (~2 ms) from disk. `stage_pack` now reads those three on the reload worker, next to the atlas build, and the apply step only installs them: - `Audio::reload_with(root, registry)` (`reload` calls it with `SoundRegistry::load`). - `ui::read_metadata` / `ui::set_metadata` (`load_metadata` is the two in a row, unchanged for startup). - If the player picks another language while the reload runs, the apply step loads that language instead of the staged one, so their choice still wins. ### A/B: F3+T, Mac mini M4 Pro, RD 12, 3 alternated pairs (`tools/pacing_bench.py --scenarios reload`, #7175) Both builds had temporary timing laps in `apply_staged_pack` to break the frame down; the laps are not in this PR. | | base 1 | new 1 | base 2 | new 2 | base 3 | new 3 | mean | |---|---|---|---|---|---|---|---| | F3+T worst frame (ms) | 84.3 | 64.5 | 89.6 | 65.8 | 95.1 | 69.1 | **89.7 → 66.5** | | sounds in that frame (ms) | 15.0 | 0 | 14.6 | 0 | 17.0 | 0.6 | 15.5 → 0.2 | | GUI metadata + language (ms) | 5.9 | 0 | 5.2 | 0 | 6.0 | 0 | 5.7 → 0 | | renderer rebuild (ms, unchanged) | 56.4 | 57.7 | 63.3 | 59.3 | 65.0 | 61.8 | — | What remains of the frame is mostly the renderer rebuild (~60 ms), for a later PR. pr_ready below. Its one ❌ is the `horizon-client-render` lib tests getting SIGSEGV under llvmpipe when run in parallel, which also happens on main. Run single-threaded on the same head (`cargo test -p horizon-client-render --lib -- --test-threads=1`), they pass: 1149 passed, 0 failed. **pr_ready** (`tools/pr_ready.py --quick` on playhorizon, against origin/main at 7d0df99a7, 10 min 52 s) | Check | Result | | --- | --- | | Scope | ✅ 3 files, +56 −7 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ (1 s) | | Python tests | ✅ 612 passed (1 min 13 s) | | rustfmt | ✅ (15 s) | | clippy | ✅ (3 min 27 s) | | tests: horizon-client, horizon-client-render | ❌ 677 passed (4 min 35 s) | | doc tests | ✅ 0 passed (6 s) | | content root tests | ➖ content root untouched | | mod API up to date | ✅ (40 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ➖ launcher untouched | | launcher clippy | ➖ launcher untouched | | launcher tests | ➖ launcher untouched | | Parity | ➖ 141 affected, to run in CI (--quick): ambient_sound, anvil_turtle_egg, armor_stand_frost, armor_stand_turtle_egg, arrow, arrow_wind_charge, audio_attributes, auto_jump, blending, block_entity_anim, block_entity_render, block_entity_tickers and 129 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 06:38:57 +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#7398
No description provided.