[PR #6760] [MERGED] Native builds: a dev profile for mod developers #7078

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

📋 Pull Request Information

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

Base: main ← Head: v2/ses_01M6BECNQ499TYMMBQBDF00VJ5-native-profiles-e


📝 Commits (6)

  • 9200058 Native builds: default, dev and release profiles
  • 42c9bd6 Merge main into native build profiles
  • a61d9ae Native builds: performance and dev profiles
  • 823829a Native builds: point mod developers at the dev profile
  • 785f269 Native builds: drop a repeated build key check
  • 086a3c7 Native builds: dev in the Mods page picker only

📊 Changes

20 files changed (+331 additions, -144 deletions)

View changed files

📝 AGENTS.md (+4 -0)
📝 docs/launcher-commands.md (+2 -2)
📝 docs/native-mods.md (+35 -14)
📝 launcher/lang/de.json (+5 -0)
📝 launcher/lang/es.json (+5 -0)
📝 launcher/lang/fr.json (+5 -0)
📝 launcher/lang/ja.json (+5 -0)
📝 launcher/lang/pl.json (+5 -0)
📝 launcher/lang/pt-br.json (+5 -0)
📝 launcher/lang/ru.json (+5 -0)
📝 launcher/lang/tr.json (+5 -0)
📝 launcher/lang/uk.json (+5 -0)
📝 launcher/lang/zh.json (+5 -0)
📝 launcher/src/backend.rs (+5 -2)
📝 launcher/src/cli.rs (+21 -14)
📝 launcher/src/main.rs (+1 -1)
📝 launcher/src/mods_page.rs (+34 -11)
📝 launcher/src/native_mods.rs (+172 -94)
📝 launcher/src/native_mods/inject.rs (+5 -5)
📝 launcher/src/native_mods/inject_cache.rs (+2 -1)

📄 Description

🤖 Opened by Aria's agent swarm, Dyna, not by Aria.

What this does

Native mods compile with the workspace's fast profile, so every mod edit rebuilds an optimized horizon-client, about a minute each time. For a mod author iterating on code, most of that is optimizing the game crate. This PR adds a dev profile for that and names today's build performance:

Profile Cargo What it is
performance --profile fast, unchanged The default, for playing with mods: today's build, with the same build key, build record and native/target/fast/ folder, so existing warm builds and installed versions stay valid and nothing rebuilds on upgrade
dev --profile fast --config profile.fast.package.horizon-client.opt-level=0 For developing a mod: a mod edit rebuilds about 6× faster, while game logic runs up to about twice as slow, so it's for iterating, not playing
release --profile release, unchanged Upstream's existing release build (thin LTO, one codegen unit)

fast keeps Cargo's default lto = false: thin-local LTO across one crate's 16 codegen units, none across crates. dev changes only horizon-client's opt-level, so horizon-client-lib, -render and -world stay at opt-level 3.

dev shares performance's folder. Every crate but horizon-client gets identical flags, so switching between the two recompiles only horizon-client, not all 294 crates. Cargo keeps both builds of horizon-client side by side under different metadata hashes, so switching back finds the other one still there. Each profile still has its own build key, so their installed builds never mix. The --config goes only to the launcher's Cargo command, so the workspace's own [profile.fast] (the e2e tools, cargo build --profile fast) is untouched.

Picking one:

  • the Mods page's "Native build" row: a three-way picker (Performance build, Dev build, Release build), replacing the release switch;
  • horizon-launcher settings native-profile performance|dev|release ("default" resets it; the older value fast still means performance);
  • native-build --profile …, which --server-output takes too;
  • an older settings file's release switch still picks release.

For mod developers: AGENTS.md, the top of the launcher section in docs/native-mods.md, and the CLI's "Build it next" hint after mods install say to opt in with settings native-profile dev. It's an explicit opt-in: nothing is guessed from folders or the CLI. Players and releases stay on performance.

docs/native-mods.md describes the three profiles; docs/launcher-commands.md is regenerated. The changed captions are translated into the launcher's 10 languages.

Measurements

One machine, an RTX 3090 Ti on Vulkan, with the machine sample's mixin bundle. Builds go through the launcher at 10 jobs and lowest priority; times are Cargo's, with the launcher's end to end in brackets; 1-minute load 1.5–9. Ticks (the server's rolling average, 3 samples) and frames (30 s, horizon-ctl stats) are at 1280×720, render distance 8, no frame cap, after a 30 s settle, in an ordinary scene (a fixed view of seed 42) and a 200-cow pen. The mixin edit adds an eprintln! in the sample's injected function (only horizon-client recompiles); the renderer edit is about 15 lines of real code in Renderer::render (horizon-client-render, -lib and horizon-client recompile). A cold build compiles all 294 crates into an empty profile folder, as a player's first native build does. These rows were measured on an earlier revision of this branch where dev had its own target folder; both profiles' compiler settings were the same as here.

Profile Ordinary tick (ms) Heavy tick (ms) Heavy frame mean / p99 (ms) Mixin edit Renderer edit Cold build
performance (default, today's build) 2.77 9.60 1.94 / 3.29 59.0 s (63.1 s) 48.5 s (53.3 s) 149 s (155 s)
dev 5.05 (+82%) 12.58 (+31%) 2.58 / 4.11 9.4 s (13.2 s) 13.8 s (17.4 s) 99 s (104 s)

The release and player builds are unchanged: game-build.yml and [profile.release] aren't touched.

In-game proof

At this head, on a Linux box (llvmpipe), through the launcher with the machine sample's mixin bundle repinned to this head, on the server thread:

  • Both profiles in game: after an eprintln! edit in the sample's injected function, the dev build and the performance build each logged G20_PROOF machine entity created when the machine was placed, and the machine turned 4 cobblestone in its input into 4 stone in its output, checked with a server-side container read.
  • Sharing the folder: the first switch from a warm performance build to dev compiled only horizon-client, with no dependency rebuilt (Cargo 34.5 s, 39.9 s end to end, against 294 crates and 3 min 11 s for the first performance build). Switching back and forth after that compiled nothing, and native/target/fast/deps/ held both horizon-client binaries side by side. After the edit, each profile again recompiled only horizon-client, and performance reused its own incremental state.
  • Settings: settings native-profile dev reads back dev, and the older value fast reads back performance.

Test route: https://github.com/arismoko/horizon-machine-sample (used)

Self-check

Run at this head, 086a3c7c2a:

pr_ready (tools/pr_ready.py --quick --base 57cc476ac8 on f2196cc12001, against 57cc476ac8 at 57cc476ac, 49 s)

Check Result
Scope ✅ 20 files, +331 −144
Cargo.lock ✅ unchanged
Public tree ✅
Python tests ✅ 602 passed (35 s)
rustfmt ➖ no Rust change
clippy ➖ no Rust change
tests ➖ no crate touched
doc tests ➖ no crate touched
content root tests ➖ content root untouched
mod API up to date ➖ native hooks untouched
tokens.css up to date ➖ theme untouched
launcher rustfmt ✅ (1 s)
launcher clippy ✅ (4 s)
launcher tests ✅ 424 passed (9 s)
Parity ➖ not run (--quick): CI's parity job picks the affected harnesses
Label player-facing: feature if players get something new, no label for a fix (release-now if urgent)

Please merge with a merge commit rather than squash, so commit authorship is kept.

🤖 Generated with Dyna.


🔄 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/6760 **Author:** [@arismoko](https://github.com/arismoko) **Created:** 11/2/2026 **Status:** ✅ Merged **Merged:** 11/2/2026 **Merged by:** [@ludovic111](https://github.com/ludovic111) **Base:** `main` ← **Head:** `v2/ses_01M6BECNQ499TYMMBQBDF00VJ5-native-profiles-e` --- ### 📝 Commits (6) - [`9200058`](https://github.com/horizon-rust/horizon/commit/920005887503ba4e600d8a4ba4e6f9d73daa09c4) Native builds: default, dev and release profiles - [`42c9bd6`](https://github.com/horizon-rust/horizon/commit/42c9bd6d95202d72f799bb84228042d3236310be) Merge main into native build profiles - [`a61d9ae`](https://github.com/horizon-rust/horizon/commit/a61d9ae2375b1fc911488b955ba2983c0bb6f656) Native builds: performance and dev profiles - [`823829a`](https://github.com/horizon-rust/horizon/commit/823829a781512bc435f2f127e44f4d4a9a8100a2) Native builds: point mod developers at the dev profile - [`785f269`](https://github.com/horizon-rust/horizon/commit/785f269a40e71e2b462e9b86ae2a9fa644a41b38) Native builds: drop a repeated build key check - [`086a3c7`](https://github.com/horizon-rust/horizon/commit/086a3c7c2a4c34841c50d6bcd3292243ecd6c3ad) Native builds: dev in the Mods page picker only ### 📊 Changes **20 files changed** (+331 additions, -144 deletions) <details> <summary>View changed files</summary> 📝 `AGENTS.md` (+4 -0) 📝 `docs/launcher-commands.md` (+2 -2) 📝 `docs/native-mods.md` (+35 -14) 📝 `launcher/lang/de.json` (+5 -0) 📝 `launcher/lang/es.json` (+5 -0) 📝 `launcher/lang/fr.json` (+5 -0) 📝 `launcher/lang/ja.json` (+5 -0) 📝 `launcher/lang/pl.json` (+5 -0) 📝 `launcher/lang/pt-br.json` (+5 -0) 📝 `launcher/lang/ru.json` (+5 -0) 📝 `launcher/lang/tr.json` (+5 -0) 📝 `launcher/lang/uk.json` (+5 -0) 📝 `launcher/lang/zh.json` (+5 -0) 📝 `launcher/src/backend.rs` (+5 -2) 📝 `launcher/src/cli.rs` (+21 -14) 📝 `launcher/src/main.rs` (+1 -1) 📝 `launcher/src/mods_page.rs` (+34 -11) 📝 `launcher/src/native_mods.rs` (+172 -94) 📝 `launcher/src/native_mods/inject.rs` (+5 -5) 📝 `launcher/src/native_mods/inject_cache.rs` (+2 -1) </details> ### 📄 Description > 🤖 Opened by Aria's agent swarm, Dyna, not by Aria. ## What this does Native mods compile with the workspace's `fast` profile, so every mod edit rebuilds an optimized `horizon-client`, about a minute each time. For a mod author iterating on code, most of that is optimizing the game crate. This PR adds a `dev` profile for that and names today's build `performance`: | Profile | Cargo | What it is | |---|---|---| | `performance` | `--profile fast`, unchanged | The default, for playing with mods: today's build, with the same build key, build record and `native/target/fast/` folder, so existing warm builds and installed versions stay valid and nothing rebuilds on upgrade | | `dev` | `--profile fast --config profile.fast.package.horizon-client.opt-level=0` | For developing a mod: a mod edit rebuilds about 6× faster, while game logic runs up to about twice as slow, so it's for iterating, not playing | | `release` | `--profile release`, unchanged | Upstream's existing release build (thin LTO, one codegen unit) | `fast` keeps Cargo's default `lto = false`: thin-local LTO across one crate's 16 codegen units, none across crates. `dev` changes only `horizon-client`'s opt-level, so `horizon-client-lib`, `-render` and `-world` stay at opt-level 3. **`dev` shares `performance`'s folder.** Every crate but `horizon-client` gets identical flags, so switching between the two recompiles only `horizon-client`, not all 294 crates. Cargo keeps both builds of `horizon-client` side by side under different metadata hashes, so switching back finds the other one still there. Each profile still has its own build key, so their installed builds never mix. The `--config` goes only to the launcher's Cargo command, so the workspace's own `[profile.fast]` (the e2e tools, `cargo build --profile fast`) is untouched. **Picking one:** - the Mods page's "Native build" row: a three-way picker (Performance build, Dev build, Release build), replacing the release switch; - `horizon-launcher settings native-profile performance|dev|release` ("default" resets it; the older value `fast` still means `performance`); - `native-build --profile …`, which `--server-output` takes too; - an older settings file's release switch still picks `release`. **For mod developers:** `AGENTS.md`, the top of the launcher section in `docs/native-mods.md`, and the CLI's "Build it next" hint after `mods install` say to opt in with `settings native-profile dev`. It's an explicit opt-in: nothing is guessed from folders or the CLI. Players and releases stay on `performance`. `docs/native-mods.md` describes the three profiles; `docs/launcher-commands.md` is regenerated. The changed captions are translated into the launcher's 10 languages. ## Measurements One machine, an RTX 3090 Ti on Vulkan, with the [machine sample](https://github.com/arismoko/horizon-machine-sample)'s mixin bundle. Builds go through the launcher at 10 jobs and lowest priority; times are Cargo's, with the launcher's end to end in brackets; 1-minute load 1.5–9. Ticks (the server's rolling average, 3 samples) and frames (30 s, `horizon-ctl stats`) are at 1280×720, render distance 8, no frame cap, after a 30 s settle, in an ordinary scene (a fixed view of seed 42) and a 200-cow pen. The mixin edit adds an `eprintln!` in the sample's injected function (only `horizon-client` recompiles); the renderer edit is about 15 lines of real code in `Renderer::render` (`horizon-client-render`, `-lib` and `horizon-client` recompile). A cold build compiles all 294 crates into an empty profile folder, as a player's first native build does. These rows were measured on an earlier revision of this branch where `dev` had its own target folder; both profiles' compiler settings were the same as here. | Profile | Ordinary tick (ms) | Heavy tick (ms) | Heavy frame mean / p99 (ms) | Mixin edit | Renderer edit | Cold build | |---|---:|---:|---|---:|---:|---:| | `performance` (default, today's build) | 2.77 | 9.60 | 1.94 / 3.29 | 59.0 s (63.1 s) | 48.5 s (53.3 s) | 149 s (155 s) | | `dev` | 5.05 (+82%) | 12.58 (+31%) | 2.58 / 4.11 | 9.4 s (13.2 s) | 13.8 s (17.4 s) | 99 s (104 s) | The release and player builds are unchanged: game-build.yml and `[profile.release]` aren't touched. ## In-game proof At this head, on a Linux box (llvmpipe), through the launcher with the machine sample's mixin bundle repinned to this head, on the server thread: - **Both profiles in game:** after an `eprintln!` edit in the sample's injected function, the `dev` build and the `performance` build each logged `G20_PROOF machine entity created` when the machine was placed, and the machine turned 4 cobblestone in its input into 4 stone in its output, checked with a server-side container read. - **Sharing the folder:** the first switch from a warm `performance` build to `dev` compiled only `horizon-client`, with no dependency rebuilt (Cargo 34.5 s, 39.9 s end to end, against 294 crates and 3 min 11 s for the first `performance` build). Switching back and forth after that compiled nothing, and `native/target/fast/deps/` held both `horizon-client` binaries side by side. After the edit, each profile again recompiled only `horizon-client`, and `performance` reused its own incremental state. - **Settings:** `settings native-profile dev` reads back `dev`, and the older value `fast` reads back `performance`. Test route: https://github.com/arismoko/horizon-machine-sample (used) ## Self-check Run at this head, 086a3c7c2a: **pr_ready** (`tools/pr_ready.py --quick --base 57cc476ac8` on f2196cc12001, against 57cc476ac8 at 57cc476ac, 49 s) | Check | Result | | --- | --- | | Scope | ✅ 20 files, +331 −144 | | Cargo.lock | ✅ unchanged | | Public tree | ✅ | | Python tests | ✅ 602 passed (35 s) | | rustfmt | ➖ no Rust change | | clippy | ➖ no Rust change | | tests | ➖ no crate touched | | doc tests | ➖ no crate touched | | content root tests | ➖ content root untouched | | mod API up to date | ➖ native hooks untouched | | tokens.css up to date | ➖ theme untouched | | launcher rustfmt | ✅ (1 s) | | launcher clippy | ✅ (4 s) | | launcher tests | ✅ 424 passed (9 s) | | Parity | ➖ not run (--quick): CI's parity job picks the affected harnesses | | Label | player-facing: `feature` if players get something new, no label for a fix (`release-now` if urgent) | Please merge with a merge commit rather than squash, so commit authorship is kept. 🤖 Generated with Dyna. --- <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:27 +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#7078
No description provided.