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

Merged
Key-rs merged 1 commit from upstream-pr/96 into main 2026-11-25 17:09:21 +00:00
Key-rs commented 2026-11-25 14:01:54 +00:00 (Migrated from github.com)

Imported from Belobug/VIctory-Belobug-AMD. Originally posted by Key-rs on 2026-11-25T14:01:54Z.


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.
<!-- greyfinch-sync:Belobug/VIctory-Belobug-AMD:issue:6606240112 --> Imported from [Belobug/VIctory-Belobug-AMD](https://github.com/Belobug/VIctory-Belobug-AMD/pull/96). Originally posted by [Key-rs](https://github.com/Key-rs) on 2026-11-25T14:01:54Z. --- ## 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.
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
Belobug/VIctory-Belobug-AMD!96
No description provided.