build: thin LTO and one codegen unit for the release profile (1.5-2x on the submission path) #96

Manually merged
github merged 1 commit from gh-pr/96/head into gh-pr/96/base 2026-11-26 03:35:40 +00:00
Owner

@⁠Key-rs on GitHub · 2026-11-25 14:01 UTC · original
Key-rs:perf/lto → main · +4 −0 · 1 files · 1 commits · merged 2026-11-25 17:09 UTC

What

Two lines in [profile.release]:

lto = "thin"
codegen-units = 1

No code changes, no behaviour change, no new dependency. [profile.diag] inherits it, so the diagnostics build gets it too.

Why

The port's own code is on the critical path every frame: the log of a heavy world frame on my machine reads

2.8 fps, 362.8 ms/frame (85.5 preparing: copies 19.4 ms 64.0 MB,
                          textures 6.2 ms 13.6 MB, bindless plans 43.2 ms; 209.1 on the GPU …)
WARN victory_gpu::host: slow host submission ms=355 lists=43 pipelines={[compute …], …}

— i.e. ~355 ms of host-side submission per frame, the same order as the frame itself. Cross-crate inlining across victory-* help exactly there: the submission path walks descriptors, hashes ranges and patches bindings through several crates.

Measured

One machine: Ryzen 7 8845H (Zen 4), RTX 4060 Laptop 8 GB, Windows 11 26300. Belobug at 71652a2, same data, same switches (VICTORY_HAIR=1, the eight VICTORY_SKIP_PIPELINES from the README), same scripted input, world frames only:

draws/frame before after
~600 1452 ms 443 ms
~800 728 ms ~590 ms
~900 801 ms 347 ms
~1000 914 ms 722 ms

Roughly 1.5–2× on the CPU-side path, which is what took it from 1 fps to 2–3 fps in the world here. Build time goes from 1m05s to 1m41s.

There is also a local-only extra I did not put in the tree, because it is not portable:

RUSTFLAGS="-C target-cpu=native" cargo build --release -p victory

On a Zen 4 host that is part of the numbers above; on any other CPU it is whatever native means there. Worth mentioning in the README next to the other build switches rather than committing.

Notes

  • Only Cargo.toml changes; cargo xtask policy and the test suite are untouched by a profile setting.
  • If you would rather not slow the build down for everyone, lto = "fat" is the same idea taken further and I can measure that instead; and if you want the default build kept as it is, this could live behind an opt-in profile (say [profile.release-lto]) — say which shape you prefer.
**@⁠Key-rs** on GitHub · 2026-11-25 14:01 UTC · [original](https://github.com/Belobug/VIctory-Belobug-AMD/pull/96) `Key-rs:perf/lto` → `main` · +4 −0 · 1 files · 1 commits · merged 2026-11-25 17:09 UTC ## What Two lines in `[profile.release]`: ```toml lto = "thin" codegen-units = 1 ``` No code changes, no behaviour change, no new dependency. `[profile.diag]` inherits it, so the diagnostics build gets it too. ## Why The port's own code is on the critical path every frame: the log of a heavy world frame on my machine reads ``` 2.8 fps, 362.8 ms/frame (85.5 preparing: copies 19.4 ms 64.0 MB, textures 6.2 ms 13.6 MB, bindless plans 43.2 ms; 209.1 on the GPU …) WARN victory_gpu::host: slow host submission ms=355 lists=43 pipelines={[compute …], …} ``` — i.e. ~355 ms of host-side submission per frame, the same order as the frame itself. Cross-crate inlining across `victory-*` help exactly there: the submission path walks descriptors, hashes ranges and patches bindings through several crates. ## Measured One machine: Ryzen 7 8845H (Zen 4), RTX 4060 Laptop 8 GB, Windows 11 26300. Belobug at `71652a2`, same data, same switches (`VICTORY_HAIR=1`, the eight `VICTORY_SKIP_PIPELINES` from the README), same scripted input, world frames only: | draws/frame | before | after | |---|---|---| | ~600 | 1452 ms | **443 ms** | | ~800 | 728 ms | ~590 ms | | ~900 | 801 ms | **347 ms** | | ~1000 | 914 ms | 722 ms | Roughly **1.5–2× on the CPU-side path**, which is what took it from 1 fps to 2–3 fps in the world here. Build time goes from 1m05s to 1m41s. There is also a local-only extra I did not put in the tree, because it is not portable: ``` RUSTFLAGS="-C target-cpu=native" cargo build --release -p victory ``` On a Zen 4 host that is part of the numbers above; on any other CPU it is whatever `native` means there. Worth mentioning in the README next to the other build switches rather than committing. ## Notes * Only `Cargo.toml` changes; `cargo xtask policy` and the test suite are untouched by a profile setting. * If you would rather not slow the build down for everyone, `lto = "fat"` is the same idea taken further and I can measure that instead; and if you want the default build kept as it is, this could live behind an opt-in profile (say `[profile.release-lto]`) — say which shape you prefer.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:39 +00:00
github manually merged commit a23d1b465d into gh-pr/96/base 2026-11-26 03:35:40 +00:00
This discussion has been locked. Commenting is limited to contributors.
No description provided.