[PR #7055] [MERGED] Prepared data file: textures, models, blockstates, item definitions and the HUD atlas read through it #7301

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

📋 Pull Request Information

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

Base: main ← Head: perf/prepared-data-assets


📝 Commits (3)

  • 98d5444 Prepared data file: textures, models, blockstates and item definitions read through it
  • ccc9b8c Prepared data file: the HUD atlas's textures, headers and .mcmeta read through it
  • e1b514f Format the read_head test

📊 Changes

7 files changed (+124 additions, -60 deletions)

View changed files

📝 crates/horizon-client-render/src/hud.rs (+14 -7)
📝 crates/horizon-client-render/src/model_library.rs (+3 -3)
📝 crates/horizon-client-render/src/models/catalog.rs (+2 -2)
📝 crates/horizon-client-render/src/sprites.rs (+13 -11)
📝 crates/horizon-client-render/src/trims.rs (+5 -4)
📝 crates/horizon-client/src/item_render.rs (+21 -32)
📝 crates/horizon-core/src/prepared_files.rs (+66 -1)

📄 Description

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

Part of #1961. Follows #6893 and #6976 (the data file, then tags, registries and advancements through it).

What

The client's assets now read from horizon-data.bin when the prepared root has a current one. Before, every file was opened from the folders:

  • sprites.rs: block and item sprite PNGs and their .mcmeta.
  • models/catalog.rs: blockstates.
  • model_library.rs: block and item models.
  • item_render.rs: items/ definitions, read through json_folder.
  • hud.rs: the HUD atlas. This was the biggest one: it walks textures/{gui,block,item,entity,particle,…} and opened each PNG twice (a 24-byte header for its size, then the whole file), plus a .mcmeta probe.
  • trims.rs: trim headers and palettes.

prepared_files gains read_head(path, max), so a PNG header comes from the data file without reading the whole entry. A file the data file doesn't hold (most .mcmeta, LabPBR maps) is NotFound without a disk lookup. The data file only exists for a root horizon-prepare made, and it is refused when stale, so packs and mirrors still read from their folders.

A/B (playhorizon, llvmpipe; a copy of the prepared root with its horizon-data.bin; strace of a --world start until the full view; 2 rounds each)

main (#6976) this PR
files opened under the prepared root 21,990 / 22,003 6,738 / 6,744 (main before #6893: 40,282)
assets/minecraft/textures 10,100 1,985
assets/minecraft/models 4,210 18
assets/minecraft/items 1,658 0
assets/minecraft/blockstates 1,286 0
every openat of the process 30,560 / 27,237 9,190 / 9,312
title shown, ms (under strace) 10,025 / 7,069 4,577 / 3,432
world full view, ms (under strace) 37,335 / 21,083 20,194 / 16,179

The times are under strace on a software renderer and swing a lot between runs. The open counts are the signal. Each open is what Windows Defender scans on a real start, which is the slow-disk case #1961 is about.

What still opens files at world start (next PR): about 320 real .mcmeta files read by another scanner, sounds (.ogg, deliberately not in the data file), worldgen/structure NBTs, villager trades, biomes, enchantments, particles and paintings.

Checks

On playhorizon: horizon-core prepared_files (4, now including read_head); horizon-client-render hud::, trims::, sprites and model library (74, --test-threads=1); horizon-client-lib item_render (34); clippy -D warnings on horizon-core and horizon-client-render. CI runs the rest.

🤖 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/7055 **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/prepared-data-assets` --- ### 📝 Commits (3) - [`98d5444`](https://github.com/horizon-rust/horizon/commit/98d5444594b77dff3ac437456b44e96fcdc1aa20) Prepared data file: textures, models, blockstates and item definitions read through it - [`ccc9b8c`](https://github.com/horizon-rust/horizon/commit/ccc9b8caf57db660e4f3afaa624ec97c693d1c74) Prepared data file: the HUD atlas's textures, headers and .mcmeta read through it - [`e1b514f`](https://github.com/horizon-rust/horizon/commit/e1b514fe2ea938b8398629406a48a89c9e2e9ebd) Format the read_head test ### 📊 Changes **7 files changed** (+124 additions, -60 deletions) <details> <summary>View changed files</summary> 📝 `crates/horizon-client-render/src/hud.rs` (+14 -7) 📝 `crates/horizon-client-render/src/model_library.rs` (+3 -3) 📝 `crates/horizon-client-render/src/models/catalog.rs` (+2 -2) 📝 `crates/horizon-client-render/src/sprites.rs` (+13 -11) 📝 `crates/horizon-client-render/src/trims.rs` (+5 -4) 📝 `crates/horizon-client/src/item_render.rs` (+21 -32) 📝 `crates/horizon-core/src/prepared_files.rs` (+66 -1) </details> ### 📄 Description > 🤖 Opened by Ludovic's AI agent (Claude), not by Ludovic himself. Part of #1961. Follows #6893 and #6976 (the data file, then tags, registries and advancements through it). ## What The client's assets now read from `horizon-data.bin` when the prepared root has a current one. Before, every file was opened from the folders: - `sprites.rs`: block and item sprite PNGs and their `.mcmeta`. - `models/catalog.rs`: blockstates. - `model_library.rs`: block and item models. - `item_render.rs`: `items/` definitions, read through `json_folder`. - `hud.rs`: the HUD atlas. This was the biggest one: it walks `textures/{gui,block,item,entity,particle,…}` and opened each PNG twice (a 24-byte header for its size, then the whole file), plus a `.mcmeta` probe. - `trims.rs`: trim headers and palettes. `prepared_files` gains `read_head(path, max)`, so a PNG header comes from the data file without reading the whole entry. A file the data file doesn't hold (most `.mcmeta`, LabPBR maps) is `NotFound` without a disk lookup. The data file only exists for a root `horizon-prepare` made, and it is refused when stale, so packs and mirrors still read from their folders. ## A/B (playhorizon, llvmpipe; a copy of the prepared root with its `horizon-data.bin`; strace of a `--world` start until the full view; 2 rounds each) | | main (#6976) | this PR | |---|---:|---:| | files opened under the prepared root | 21,990 / 22,003 | **6,738 / 6,744** (main before #6893: 40,282) | | `assets/minecraft/textures` | 10,100 | **1,985** | | `assets/minecraft/models` | 4,210 | **18** | | `assets/minecraft/items` | 1,658 | **0** | | `assets/minecraft/blockstates` | 1,286 | **0** | | every `openat` of the process | 30,560 / 27,237 | **9,190 / 9,312** | | title shown, ms (under strace) | 10,025 / 7,069 | 4,577 / 3,432 | | world full view, ms (under strace) | 37,335 / 21,083 | 20,194 / 16,179 | The times are under strace on a software renderer and swing a lot between runs. The open counts are the signal. Each open is what Windows Defender scans on a real start, which is the slow-disk case #1961 is about. What still opens files at world start (next PR): about 320 real `.mcmeta` files read by another scanner, sounds (`.ogg`, deliberately not in the data file), `worldgen/structure` NBTs, villager trades, biomes, enchantments, particles and paintings. ## Checks On playhorizon: `horizon-core` `prepared_files` (4, now including `read_head`); `horizon-client-render` `hud::`, `trims::`, sprites and model library (74, `--test-threads=1`); `horizon-client-lib` `item_render` (34); clippy `-D warnings` on `horizon-core` and `horizon-client-render`. CI runs the rest. 🤖 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:37:22 +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#7301
No description provided.