[PR #6745] [MERGED] Recipes: the loot data and the server's sync share one read of the recipe folder #7066

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

📋 Pull Request Information

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

Base: main ← Head: perf/recipes-read-once-2


📝 Commits (3)

  • 4a4cfcd Recipes: the loot data and the server's sync share the recipe folder's read
  • 916cca3 Recipes: the --world launch preload holds the recipe folder too
  • 4c877c4 Launcher lock: horizon-world's new log dependency

📊 Changes

10 files changed (+35 additions, -25 deletions)

View changed files

📝 Cargo.lock (+1 -0)
📝 crates/horizon-client-render/src/lib.rs (+1 -1)
📝 crates/horizon-client/src/game/world_loading.rs (+8 -0)
📝 crates/horizon-client/src/lan/data.rs (+4 -0)
📝 crates/horizon-client/src/lan/recipes.rs (+11 -12)
📝 crates/horizon-world/Cargo.toml (+1 -0)
📝 crates/horizon-world/src/json_folder.rs (+0 -0)
📝 crates/horizon-world/src/lib.rs (+1 -0)
📝 crates/horizon-world/src/loot.rs (+7 -12)
📝 launcher/Cargo.lock (+1 -0)

📄 Description

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

Part of #1961 (slow disks: per-file opens). Follow-up to #6695.

After #6695 a start still opened each recipe file 4 times (strace -k on stick.json): the rest loader (shared since #6695), then on the server-data preload thread LootData::load (smelting recipes through loot::load_kind), lan::recipes::network_recipes, and the recipe book's RecipeIndex.

  • json_folder moves from horizon-client-render to horizon-world (render re-exports it under the old path), so loot::load_dir can read through it.
  • loot::load_dir and the LAN recipe sync read through json_folder.
  • Both world data preloads (the title's world screens and a --world launch) hold the recipe folder around loot_data + sync_data; SyncData::load holds it too (for the paths without a preload).
  • launcher/Cargo.lock: horizon-world's new log dependency.

Behaviour is unchanged: same ids (namespace:path/without/.json), same files, the loot loader still fails on an unreadable or broken file, the sync still skips it.

A/B (playhorizon, llvmpipe, strace on data/minecraft/recipe/stick.json)

Base = main e9eb640ac0, new = 4c877c4c4, --profile fast, tools/startup_trace.py, strace -f -k -P …/recipe/stick.json -e trace=openat.

base new
opens of one recipe file, start → title 4 2
opens of one recipe file, --world start → in world 6 2–4 (2 runs: 2 and 4)
recipe files opened per start → in world (×2,042 files) 12,252 4,084–8,174
server.open_world, 3 interleaved runs (ms) 1168 / 1924 / 2359 1353 / 994 / 1807
world.first_frame, 7 interleaved runs, median (ms) 8169 8676

The box was at load 14–20 on 8 vCPUs (other build slots): wall times are noise at this scale (the base's own first frame ranged 5.7–12.5 s); the change is in the file count, which is what costs on a slow disk or with Windows Defender (#1961: ~1 ms per file opened). The sharing is through a weak handle, so it depends on timing: a reader shares the folder only if another one holds it, read, at that moment. The opens left are the rest loader's, the world data preload's and, at a --world launch, the server thread's own second SyncData::load (#6729 removes that one). The pack file of #1961 (#4267) takes the file count out of the question for every folder; this PR is the cheap step before it.

Parity: crafter entity_death_loot ghost_recipe place_recipe recipe_book recipe recipe_book_view spawn_loot trial on playhorizon at 4c877c4c4: 8/8 PASS (spawn_loot under Xvfb). PR CI selects no harness (no harness change); verify and launcher pass on 4c877c4c4.

🤖 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/6745 **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/recipes-read-once-2` --- ### 📝 Commits (3) - [`4a4cfcd`](https://github.com/horizon-rust/horizon/commit/4a4cfcd68ffa06b62e766dd9a63805fb561b09eb) Recipes: the loot data and the server's sync share the recipe folder's read - [`916cca3`](https://github.com/horizon-rust/horizon/commit/916cca3b77b95be28a1f709f9305e3e6efe8b0f1) Recipes: the --world launch preload holds the recipe folder too - [`4c877c4`](https://github.com/horizon-rust/horizon/commit/4c877c4c496327e9bd6cd258e2e09eac06342ec4) Launcher lock: horizon-world's new log dependency ### 📊 Changes **10 files changed** (+35 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+1 -0) 📝 `crates/horizon-client-render/src/lib.rs` (+1 -1) 📝 `crates/horizon-client/src/game/world_loading.rs` (+8 -0) 📝 `crates/horizon-client/src/lan/data.rs` (+4 -0) 📝 `crates/horizon-client/src/lan/recipes.rs` (+11 -12) 📝 `crates/horizon-world/Cargo.toml` (+1 -0) 📝 `crates/horizon-world/src/json_folder.rs` (+0 -0) 📝 `crates/horizon-world/src/lib.rs` (+1 -0) 📝 `crates/horizon-world/src/loot.rs` (+7 -12) 📝 `launcher/Cargo.lock` (+1 -0) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #1961 (slow disks: per-file opens). Follow-up to #6695. After #6695 a start still opened each recipe file 4 times (strace `-k` on `stick.json`): the rest loader (shared since #6695), then on the server-data preload thread `LootData::load` (smelting recipes through `loot::load_kind`), `lan::recipes::network_recipes`, and the recipe book's `RecipeIndex`. - `json_folder` moves from `horizon-client-render` to `horizon-world` (render re-exports it under the old path), so `loot::load_dir` can read through it. - `loot::load_dir` and the LAN recipe sync read through `json_folder`. - Both world data preloads (the title's world screens and a `--world` launch) hold the recipe folder around `loot_data` + `sync_data`; `SyncData::load` holds it too (for the paths without a preload). - `launcher/Cargo.lock`: horizon-world's new `log` dependency. Behaviour is unchanged: same ids (`namespace:path/without/.json`), same files, the loot loader still fails on an unreadable or broken file, the sync still skips it. ## A/B (playhorizon, llvmpipe, strace on `data/minecraft/recipe/stick.json`) Base = main e9eb640ac0, new = 4c877c4c4, `--profile fast`, `tools/startup_trace.py`, `strace -f -k -P …/recipe/stick.json -e trace=openat`. | | base | new | |---|---:|---:| | opens of one recipe file, start → title | 4 | **2** | | opens of one recipe file, `--world` start → in world | 6 | **2–4** (2 runs: 2 and 4) | | recipe files opened per start → in world (×2,042 files) | 12,252 | **4,084–8,174** | | `server.open_world`, 3 interleaved runs (ms) | 1168 / 1924 / 2359 | 1353 / 994 / 1807 | | `world.first_frame`, 7 interleaved runs, median (ms) | 8169 | 8676 | The box was at load 14–20 on 8 vCPUs (other build slots): wall times are noise at this scale (the base's own first frame ranged 5.7–12.5 s); the change is in the file count, which is what costs on a slow disk or with Windows Defender (#1961: ~1 ms per file opened). The sharing is through a weak handle, so it depends on timing: a reader shares the folder only if another one holds it, read, at that moment. The opens left are the rest loader's, the world data preload's and, at a `--world` launch, the server thread's own second `SyncData::load` (#6729 removes that one). The pack file of #1961 (#4267) takes the file count out of the question for every folder; this PR is the cheap step before it. Parity: `crafter entity_death_loot ghost_recipe place_recipe recipe_book recipe recipe_book_view spawn_loot trial` on playhorizon at 4c877c4c4: **8/8 PASS** (`spawn_loot` under Xvfb). PR CI selects no harness (no harness change); verify and launcher pass on 4c877c4c4. 🤖 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:33:07 +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#7066
No description provided.