[PR #1965] [MERGED] Launcher: precompile resource exporters and share exporter JVMs #3894

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

📋 Pull Request Information

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

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


📝 Commits (6)

  • f45e3f1 Optimize launcher preparation with precompiled, batched exporters
  • 03190ec Update the runtime download fixture for runtime-only discovery
  • 3adff15 Record preparation validation timings and measurement limits
  • 40f7935 release: build the preparer and compile the exporters fresh in the exporters job
  • 045bda8 release: give the exporters job an hour, as the Mac builds
  • dd1581c Merge remote-tracking branch 'origin/main' into cg15/1965

📊 Changes

21 files changed (+833 additions, -78 deletions)

View changed files

📝 .github/workflows/release.yml (+46 -1)
📝 .gitignore (+3 -0)
📝 README.md (+1 -1)
➕ crates/horizon-prepare/src/exporters.rs (+218 -0)
📝 crates/horizon-prepare/src/java.rs (+28 -17)
📝 crates/horizon-prepare/src/lib.rs (+48 -37)
📝 crates/horizon-prepare/src/main.rs (+7 -3)
➕ crates/horizon-prepare/src/worker.rs (+79 -0)
📝 crates/horizon-prepare/tests/java_selection.rs (+14 -2)
📝 docs/hosting.md (+1 -1)
➕ docs/launcher-preparation.md (+61 -0)
📝 launcher/src/backend.rs (+21 -9)
📝 launcher/src/backend/java_tests.rs (+1 -1)
📝 launcher/src/mojang.rs (+2 -2)
📝 launcher/src/mojang_tests.rs (+4 -0)
➕ mods/horizon/src/test/java/dev/horizonlab/parity/PrepareWorker.java (+69 -0)
📝 mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java (+22 -2)
📝 packaging/PLAY.txt (+1 -1)
➕ tests/test_prepare_exporters.py (+37 -0)
➕ tools/check_prepare_exporters.py (+145 -0)

...and 1 more files

📄 Description

🤖 Opened by rdbtCVS's AI agent (Codex), not by rdbtCVS personally.

What and why

Fresh release preparation currently invokes the Java compiler 15 times and starts 18 exporter/data-generator JVMs. This moves compilation to release builds and reduces preparation to five JVMs:

  • Build separate server/client bundles of our original exporter classes against the pinned jars. Compile implicit shared helpers once per classpath, verify every class and signature with -Xverify:all, and distribute the same bundle with every game/server release.
  • Keep development compilation with a source/dependency/compiler-settings key, class integrity hashes and private build staging. Releases use an installed Java runtime; older preparers and changed sources retain JDK discovery.
  • Keep one initialized JVM for compatible server exporters and another for client exporters. Restore registry tags after every task, and share immutable collision outputs, encoded states and geometry grids.
  • Keep command-registry and creative-tab exporters isolated because they replace data components. Keep data generation separate: its main method shuts down global executors. The investigation and measurement limits are in docs/launcher-preparation.md.

The release job checks two fresh isolated preparations against a runtime-only batched preparation. It compares every resource and manifest, normalizing only JSON key order, opaque lambda addresses and creative tag set ordering. It also counts JVM launches and rejects unexpected compilation.

The final local comparison matched all 23,204 resource files and their manifests, with five JVM launches and no compiler. Preparation took 133.80 / 123.79 seconds isolated, versus 56.19 seconds batched. These use precompiled exporters and a warm OS cache on a busy machine; earlier batched runs ranged from 45.05 to 120.09 seconds, so this is not a controlled speedup estimate. The earlier measured 29–52 seconds of compilation is a separate opportunity removed by release bundles.

Vanilla reference

The existing original exporters continue to call the pinned Minecraft 26.3 jars. Shared initialization uses Bootstrap.bootStrap; task cleanup restores tags through Registry.prepareTagReload. Inspected pinned net.minecraft.data.Main.main bytecode: it calls Util.shutdownExecutors, which is why the data generator retains its own process.

Validation

  • Three fresh isolated/isolated/batched comparisons; the final comparison also verifies all known noise semantically and compares manifests.
  • Six vanilla parity suites passed: collision, block_properties, block_support, face_visibility, block_landing, simple_block.
  • Game and dedicated-server packaging smoke checks: 72 original classes per bundle; packaged bundles accepted with a runtime-only Java home.
  • Compilation cache reuse, source/pin/settings invalidation, damaged classes, runtime-only discovery and comparison regression detection are covered.

Self-check

pr_ready (tools/pr_ready.py --quick on archlinux, against origin/main at d58d26c79, 1 min 41 s)

Check Result
Scope ⚠️ 21 files, +814 −78; 689 lines of code: over 500, split it if it can ship in parts; mixes CI, game, launcher
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 288 passed (30 s)
rustfmt ✅ (9 s)
clippy ✅ (2 s)
tests: horizon-prepare, xtask ✅ 35 passed (10 s)
doc tests ✅ 0 passed (2 s)
tokens.css up to date ✅
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (21 s)
launcher tests ✅ 128 passed (4 s)
Parity ➖ 49 affected, to run in CI (--quick): arrow, auto_jump, bamboo, biome_weather, block_blob, block_column, block_landing, block_pile, block_properties, block_support, block_survival, blue_ice and 37 more
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

🤖 Generated with 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/1965 **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` --- ### 📝 Commits (6) - [`f45e3f1`](https://github.com/horizon-rust/horizon/commit/f45e3f1237edbf3fc665ccec11a178f85757d5d7) Optimize launcher preparation with precompiled, batched exporters - [`03190ec`](https://github.com/horizon-rust/horizon/commit/03190ec724589fdaa639501640397b75447880ec) Update the runtime download fixture for runtime-only discovery - [`3adff15`](https://github.com/horizon-rust/horizon/commit/3adff150cf607a90675892ebe5559dee60a55669) Record preparation validation timings and measurement limits - [`40f7935`](https://github.com/horizon-rust/horizon/commit/40f79354d615be286d3ba761b194f22928f57c79) release: build the preparer and compile the exporters fresh in the exporters job - [`045bda8`](https://github.com/horizon-rust/horizon/commit/045bda8bfcb53c332af600d359fb662ac87ce0f3) release: give the exporters job an hour, as the Mac builds - [`dd1581c`](https://github.com/horizon-rust/horizon/commit/dd1581c06265539791ed235647d0681fbb83e890) Merge remote-tracking branch 'origin/main' into cg15/1965 ### 📊 Changes **21 files changed** (+833 additions, -78 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/release.yml` (+46 -1) 📝 `.gitignore` (+3 -0) 📝 `README.md` (+1 -1) ➕ `crates/horizon-prepare/src/exporters.rs` (+218 -0) 📝 `crates/horizon-prepare/src/java.rs` (+28 -17) 📝 `crates/horizon-prepare/src/lib.rs` (+48 -37) 📝 `crates/horizon-prepare/src/main.rs` (+7 -3) ➕ `crates/horizon-prepare/src/worker.rs` (+79 -0) 📝 `crates/horizon-prepare/tests/java_selection.rs` (+14 -2) 📝 `docs/hosting.md` (+1 -1) ➕ `docs/launcher-preparation.md` (+61 -0) 📝 `launcher/src/backend.rs` (+21 -9) 📝 `launcher/src/backend/java_tests.rs` (+1 -1) 📝 `launcher/src/mojang.rs` (+2 -2) 📝 `launcher/src/mojang_tests.rs` (+4 -0) ➕ `mods/horizon/src/test/java/dev/horizonlab/parity/PrepareWorker.java` (+69 -0) 📝 `mods/horizon/src/test/java/dev/horizonlab/parity/VanillaCollisionOracle.java` (+22 -2) 📝 `packaging/PLAY.txt` (+1 -1) ➕ `tests/test_prepare_exporters.py` (+37 -0) ➕ `tools/check_prepare_exporters.py` (+145 -0) _...and 1 more files_ </details> ### 📄 Description > 🤖 Opened by rdbtCVS's AI agent (Codex), not by rdbtCVS personally. ## What and why Fresh release preparation currently invokes the Java compiler 15 times and starts 18 exporter/data-generator JVMs. This moves compilation to release builds and reduces preparation to five JVMs: - Build separate server/client bundles of our original exporter classes against the pinned jars. Compile implicit shared helpers once per classpath, verify every class and signature with `-Xverify:all`, and distribute the same bundle with every game/server release. - Keep development compilation with a source/dependency/compiler-settings key, class integrity hashes and private build staging. Releases use an installed Java runtime; older preparers and changed sources retain JDK discovery. - Keep one initialized JVM for compatible server exporters and another for client exporters. Restore registry tags after every task, and share immutable collision outputs, encoded states and geometry grids. - Keep command-registry and creative-tab exporters isolated because they replace data components. Keep data generation separate: its main method shuts down global executors. The investigation and measurement limits are in `docs/launcher-preparation.md`. The release job checks two fresh isolated preparations against a runtime-only batched preparation. It compares every resource and manifest, normalizing only JSON key order, opaque lambda addresses and creative tag set ordering. It also counts JVM launches and rejects unexpected compilation. The final local comparison matched all **23,204 resource files** and their manifests, with **five JVM launches and no compiler**. Preparation took **133.80 / 123.79 seconds isolated**, versus **56.19 seconds batched**. These use precompiled exporters and a warm OS cache on a busy machine; earlier batched runs ranged from 45.05 to 120.09 seconds, so this is not a controlled speedup estimate. The earlier measured 29–52 seconds of compilation is a separate opportunity removed by release bundles. ## Vanilla reference The existing original exporters continue to call the pinned Minecraft 26.3 jars. Shared initialization uses `Bootstrap.bootStrap`; task cleanup restores tags through `Registry.prepareTagReload`. Inspected pinned `net.minecraft.data.Main.main` bytecode: it calls `Util.shutdownExecutors`, which is why the data generator retains its own process. ## Validation - Three fresh isolated/isolated/batched comparisons; the final comparison also verifies all known noise semantically and compares manifests. - Six vanilla parity suites passed: `collision`, `block_properties`, `block_support`, `face_visibility`, `block_landing`, `simple_block`. - Game and dedicated-server packaging smoke checks: 72 original classes per bundle; packaged bundles accepted with a runtime-only Java home. - Compilation cache reuse, source/pin/settings invalidation, damaged classes, runtime-only discovery and comparison regression detection are covered. ## Self-check **pr_ready** (`tools/pr_ready.py --quick` on archlinux, against origin/main at d58d26c79, 1 min 41 s) | Check | Result | | --- | --- | | Scope | ⚠️ 21 files, +814 −78; 689 lines of code: over 500, split it if it can ship in parts; mixes CI, game, launcher | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 288 passed (30 s) | | rustfmt | ✅ (9 s) | | clippy | ✅ (2 s) | | tests: horizon-prepare, xtask | ✅ 35 passed (10 s) | | doc tests | ✅ 0 passed (2 s) | | tokens.css up to date | ✅ | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (21 s) | | launcher tests | ✅ 128 passed (4 s) | | Parity | ➖ 49 affected, to run in CI (--quick): arrow, auto_jump, bamboo, biome_weather, block_blob, block_column, block_landing, block_pile, block_properties, block_support, block_survival, blue_ice and 37 more | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | 🤖 Generated with [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:04 +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#3894
No description provided.