[PR #1960] [MERGED] Reduce filesystem work in launcher resource preparation #3891

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

📋 Pull Request Information

Original PR: https://github.com/horizon-rust/horizon/pull/1960
Author: @rdbtCVS
Created: 10/25/2026
Status: ✅ Merged
Merged: 10/26/2026
Merged by: @ludovic111

Base: main ← Head: t3/optimize-launcher-resource-prepare-1


📝 Commits (1)

  • 4be53ee Reduce resource preparation filesystem work

📊 Changes

9 files changed (+637 additions, -142 deletions)

View changed files

📝 Cargo.lock (+2 -0)
📝 crates/horizon-prepare/Cargo.toml (+4 -0)
📝 crates/horizon-prepare/src/artifacts.rs (+35 -43)
➕ crates/horizon-prepare/src/files.rs (+180 -0)
📝 crates/horizon-prepare/src/lib.rs (+75 -30)
📝 crates/horizon-prepare/src/sounds.rs (+294 -68)
➕ docs/prepare-performance.md (+44 -0)
📝 launcher/Cargo.lock (+2 -0)
📝 launcher/src/backend.rs (+1 -1)

📄 Description

🤖 Opened by rdbtCVS's AI agent (OpenAI Codex, GPT-6.1).

What and why

Sound preparation was reported at 20–29 seconds with little CPU use, versus 0.9–1.4 seconds for fresh client asset extraction. Reduce repeated filesystem work in the preparer used by the launcher:

  • Share one parsed asset index across the optional imports; replace quadratic asset-name deduplication with a map.
  • Keep valid panorama, fonts and languages during JAR extraction, including with a saved index when the original launcher assets are unavailable. Check unchanged JAR members using their ZIP size/CRC instead of inflating them again; missing/corrupt members are repaired.
  • Check existing imported destinations once. Stage new copies while hashing their bytes, or clone and hash the snapshot, then publish only after the entire asset group verifies. A corrupt late panorama face leaves the previous group intact, and errors clean staged files. Verified destination files remain usable without their source objects.
  • Pass verified artifact/library results from import reuse into the same preparation instead of immediately scanning them again.
  • Attempt Linux FICLONE and macOS clonefile for independent copies, with ordinary-copy fallback. The launcher also uses this when copying compatible prepared resources between releases. No hard links.

The store exploration describes an immutable shared store's key, snapshot publication, mutable exporter outputs, repair, references and garbage collection. This PR retains independent release directories and uses filesystem clones where available. Compatibility policy stays with the launcher; this complements #1946/#1947 rather than duplicating their output-version changes.

Measurements

Release binaries before/after, the real installed sound objects, temporary output roots, Linux/ext4 (ordinary-copy fallback). One discarded warmup per binary, then three trials in alternating order with warm OS caches and no cache drops. These local results do not reproduce the reported 20–29 second environment.

Sound import Before After
Fresh output (median) 0.870s 0.489s
Verified rerun (median) 0.615s 0.305s

All 4,963 output files (377,897,148 bytes, including the index) match; the canonical path/content SHA-256 is 1f02a59512dc8c615c5652c03d4d39c0c86db7ec6130eeaaedb3964fdd19a3cb for both binaries.

Vanilla reference

None: resource preparation/launcher filesystem work; no gameplay changes or new vanilla behavior.

Self-check

pr_ready (tools/pr_ready.py on archlinux, against origin/main at d58d26c79, 2 min 8 s)

Check Result
Scope ⚠️ 9 files, +637 −142; 735 lines of code: over 500, split it if it can ship in parts; mixes game, launcher
Cargo.lock ✅ changes with a Cargo.toml
Public tree ✅ (1 s)
Python tests ➖ no Python change
rustfmt ✅ (12 s)
clippy ✅ (6 s)
tests: workspace ✅ 2108 passed (1 min 36 s)
doc tests ✅ 1 passed (8 s)
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅
launcher clippy ✅ (1 s)
launcher tests ✅ 128 passed (4 s)
Parity ➖ 335 affected, to run in CI (no vanilla data here): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 323 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Focused validation: 35 preparer unit tests plus the Java-selection integration test, and preparer clippy with warnings denied. New cases cover corrupt late assets and cleanup, copying independence and both hashing algorithms, one index snapshot serving every import, missing source objects, subsequent-run corruption repair, and JAR reruns preserving imported panorama/fonts/languages while repairing other members. Native clone success on macOS/reflink filesystems was not exercised locally; Linux ordinary-copy fallback was.

🤖 Generated with OpenAI Codex.


🔄 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/1960 **Author:** [@rdbtCVS](https://github.com/rdbtCVS) **Created:** 10/25/2026 **Status:** ✅ Merged **Merged:** 10/26/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `t3/optimize-launcher-resource-prepare-1` --- ### 📝 Commits (1) - [`4be53ee`](https://github.com/horizon-rust/horizon/commit/4be53ee28a64f126a1ab08b929eae354cba138c4) Reduce resource preparation filesystem work ### 📊 Changes **9 files changed** (+637 additions, -142 deletions) <details> <summary>View changed files</summary> 📝 `Cargo.lock` (+2 -0) 📝 `crates/horizon-prepare/Cargo.toml` (+4 -0) 📝 `crates/horizon-prepare/src/artifacts.rs` (+35 -43) ➕ `crates/horizon-prepare/src/files.rs` (+180 -0) 📝 `crates/horizon-prepare/src/lib.rs` (+75 -30) 📝 `crates/horizon-prepare/src/sounds.rs` (+294 -68) ➕ `docs/prepare-performance.md` (+44 -0) 📝 `launcher/Cargo.lock` (+2 -0) 📝 `launcher/src/backend.rs` (+1 -1) </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (OpenAI Codex, GPT-6.1). ## What and why Sound preparation was reported at 20–29 seconds with little CPU use, versus 0.9–1.4 seconds for fresh client asset extraction. Reduce repeated filesystem work in the preparer used by the launcher: - Share one parsed asset index across the optional imports; replace quadratic asset-name deduplication with a map. - Keep valid panorama, fonts and languages during JAR extraction, including with a saved index when the original launcher assets are unavailable. Check unchanged JAR members using their ZIP size/CRC instead of inflating them again; missing/corrupt members are repaired. - Check existing imported destinations once. Stage new copies while hashing their bytes, or clone and hash the snapshot, then publish only after the entire asset group verifies. A corrupt late panorama face leaves the previous group intact, and errors clean staged files. Verified destination files remain usable without their source objects. - Pass verified artifact/library results from import reuse into the same preparation instead of immediately scanning them again. - Attempt Linux FICLONE and macOS clonefile for independent copies, with ordinary-copy fallback. The launcher also uses this when copying compatible prepared resources between releases. No hard links. [The store exploration](https://github.com/rdbtCVS/horizon/blob/4be53ee28a64f126a1ab08b929eae354cba138c4/docs/prepare-performance.md) describes an immutable shared store's key, snapshot publication, mutable exporter outputs, repair, references and garbage collection. This PR retains independent release directories and uses filesystem clones where available. Compatibility policy stays with the launcher; this complements #1946/#1947 rather than duplicating their output-version changes. ## Measurements Release binaries before/after, the real installed sound objects, temporary output roots, Linux/ext4 (ordinary-copy fallback). One discarded warmup per binary, then three trials in alternating order with warm OS caches and no cache drops. These local results do not reproduce the reported 20–29 second environment. | Sound import | Before | After | | --- | ---: | ---: | | Fresh output (median) | 0.870s | 0.489s | | Verified rerun (median) | 0.615s | 0.305s | All 4,963 output files (377,897,148 bytes, including the index) match; the canonical path/content SHA-256 is `1f02a59512dc8c615c5652c03d4d39c0c86db7ec6130eeaaedb3964fdd19a3cb` for both binaries. ## Vanilla reference None: resource preparation/launcher filesystem work; no gameplay changes or new vanilla behavior. ## Self-check **pr_ready** (`tools/pr_ready.py` on archlinux, against origin/main at d58d26c79, 2 min 8 s) | Check | Result | | --- | --- | | Scope | ⚠️ 9 files, +637 −142; 735 lines of code: over 500, split it if it can ship in parts; mixes game, launcher | | Cargo.lock | ✅ changes with a Cargo.toml | | Public tree | ✅ (1 s) | | Python tests | ➖ no Python change | | rustfmt | ✅ (12 s) | | clippy | ✅ (6 s) | | tests: workspace | ✅ 2108 passed (1 min 36 s) | | doc tests | ✅ 1 passed (8 s) | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ | | launcher clippy | ✅ (1 s) | | launcher tests | ✅ 128 passed (4 s) | | Parity | ➖ 335 affected, to run in CI (no vanilla data here): active_effect_tick, active_effects, ambient_sound, anchor, arrow, attribute_health, attribute_map_queries, attribute, attribute_updates, audio_attributes, auto_jump, bamboo and 323 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Focused validation: 35 preparer unit tests plus the Java-selection integration test, and preparer clippy with warnings denied. New cases cover corrupt late assets and cleanup, copying independence and both hashing algorithms, one index snapshot serving every import, missing source objects, subsequent-run corruption repair, and JAR reruns preserving imported panorama/fonts/languages while repairing other members. Native clone success on macOS/reflink filesystems was not exercised locally; Linux ordinary-copy fallback was. 🤖 Generated with [OpenAI Codex](https://openai.com/codex/). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-03 04:13:03 +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#3891
No description provided.