[pr-performance] Dramatically increase build speed by default (-Build release for the full optimisation) #21

Manually merged
TrustNo1 merged 0 commits from xrobau/Darner:fast-builder into main 2026-12-03 18:36:13 +00:00
Contributor

What it changes

A release build takes more than 10 minutes, and most of that again after any change. The cargo setting lto = "fat" with codegen-units = 1 optimises the whole program as one unit, on one core at the end. Building from source to play, try a branch, test a pull request or bisect a crash takes 10+ mins each time.

This adds a new fast (default) build option, which (at the potential cost of some performance) dramatically improves compile speed.

  • Cargo.toml: a fast profile, inheriting release, with lto = false, codegen-units = 256 and incremental = true. It builds into target\fast, so it does not replace a release build, and the two share the shader cache (the translator's fingerprint covers its source and its Cargo.lock packages, not the profile). [profile.release] is unchanged.
  • scripts\play-nvidia.ps1:
    • The fast build is now the default (-Build fast). Every start with it prints, in yellow:
      This is not a release build: This is a fast build (target/fast), which makes
      compiling much faster, at the cost of a slight performance penalty. If you are
      testing performance, or creating a release build, generate a fully optimized
      build using the -Build release parameter (At least 10-15 mins)
      
    • -Build release gives the fully optimised build, what the default made before. -Build diag is unchanged.
    • F1's SAVE AND RESTART passes -Build back to the script, so it keeps the build it was started with, and the log header says build=fast or build=release.
    • PLAY_FRAMEGEN.cmd and PLAY_FACES_FIX.cmd already pass -Build release, so they still use release.
    • On Windows 10 the fast build gets its own Direct3D 12 runtime: the script's existing check fetches it beside whichever darner.exe it starts (Get-D3D12.cmd fills only target\release).
  • README: Fast and release builds (what each is for, both commands, the warning's text, performance checks on release); the launcher's option table ((none) is the fast build, a -Build release row); the Steam and How to run it sections name target\fast.

How it was tested

  • Tested revision: Today's main on git.gtahub.st (4a92569fb) with no conflicts.
  • Commands and results, on a 48-thread PC with an RTX 5070:
    • cargo build --locked --profile fast -p darner: 2 min 40 s from nothing, against 10 min 53 s for cargo build --release --locked -p darner of the same tree; 0.41 s with nothing changed; 6 s after an edit in apps/darner. target\fast\darner.exe --version prints darner 0.1.0. Cargo.lock unchanged.
    • The same settings given as CARGO_PROFILE_RELEASE_* variables were used to bisect a crash: 2 min 12 s from nothing, then 17 s to 2 min 1 s per step over seven steps.
    • play-nvidia.ps1 parses with no errors, and -Build defaults to fast. Its build block, run on its own: with -Build fast and no target\fast\darner.exe it ran cargo build --locked --profile fast -p darner and made it; with fast it printed the warning above; with release it printed nothing.
  • Gameplay: the game was played from fast builds (Series S, 2560x1440, DLSS, frame generation, hardware ray tracing): it started and played with no crash, and I didn't notice a significant frame-rate drop. That is an impression, not a measurement: no release and fast runs were compared in the same place.
  • cargo xtask policy: 542 files ok. No Rust source changes, so the three cargo gates were not run.
  • Coverage gaps: no measured frame-rate comparison; the Windows 10 Direct3D 12 fetch for target\fast was not run.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none
## What it changes A release build takes more than 10 minutes, and most of that again after any change. The cargo setting `lto = "fat"` with `codegen-units = 1` optimises the whole program as one unit, on one core at the end. Building from source to play, try a branch, test a pull request or bisect a crash takes 10+ mins each time. This adds a new fast (default) build option, which (at the potential cost of some performance) dramatically improves compile speed. - `Cargo.toml`: a `fast` profile, inheriting release, with `lto = false`, `codegen-units = 256` and `incremental = true`. It builds into `target\fast`, so it does not replace a release build, and the two share the shader cache (the translator's fingerprint covers its source and its `Cargo.lock` packages, not the profile). `[profile.release]` is unchanged. - `scripts\play-nvidia.ps1`: - The fast build is now the default (`-Build fast`). Every start with it prints, in yellow: ``` This is not a release build: This is a fast build (target/fast), which makes compiling much faster, at the cost of a slight performance penalty. If you are testing performance, or creating a release build, generate a fully optimized build using the -Build release parameter (At least 10-15 mins) ``` - `-Build release` gives the fully optimised build, what the default made before. `-Build diag` is unchanged. - F1's SAVE AND RESTART passes `-Build` back to the script, so it keeps the build it was started with, and the log header says `build=fast` or `build=release`. - `PLAY_FRAMEGEN.cmd` and `PLAY_FACES_FIX.cmd` already pass `-Build release`, so they still use release. - On Windows 10 the fast build gets its own Direct3D 12 runtime: the script's existing check fetches it beside whichever `darner.exe` it starts (`Get-D3D12.cmd` fills only `target\release`). - README: *Fast and release builds* (what each is for, both commands, the warning's text, performance checks on release); the launcher's option table (*(none)* is the fast build, a `-Build release` row); the Steam and *How to run it* sections name `target\fast`. ## How it was tested - Tested revision: Today's `main` on git.gtahub.st (4a92569fb) with no conflicts. - Commands and results, on a 48-thread PC with an RTX 5070: - `cargo build --locked --profile fast -p darner`: 2 min 40 s from nothing, against 10 min 53 s for `cargo build --release --locked -p darner` of the same tree; 0.41 s with nothing changed; 6 s after an edit in `apps/darner`. `target\fast\darner.exe --version` prints `darner 0.1.0`. `Cargo.lock` unchanged. - The same settings given as `CARGO_PROFILE_RELEASE_*` variables were used to bisect a crash: 2 min 12 s from nothing, then 17 s to 2 min 1 s per step over seven steps. - `play-nvidia.ps1` parses with no errors, and `-Build` defaults to `fast`. Its build block, run on its own: with `-Build fast` and no `target\fast\darner.exe` it ran `cargo build --locked --profile fast -p darner` and made it; with `fast` it printed the warning above; with `release` it printed nothing. - Gameplay: the game was played from fast builds (Series S, 2560x1440, DLSS, frame generation, hardware ray tracing): it started and played with no crash, and I didn't notice a significant frame-rate drop. That is an impression, not a measurement: no release and fast runs were compared in the same place. - `cargo xtask policy`: 542 files ok. No Rust source changes, so the three cargo gates were not run. - Coverage gaps: no measured frame-rate comparison; the Windows 10 Direct3D 12 fetch for `target\fast` was not run. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none
xrobau changed title from Dramatically increase build speed by default (-Build release for the full optimisation) to [pr-performance] Dramatically increase build speed by default (-Build release for the full optimisation) 2026-12-03 17:11:07 +00:00
TrustNo1 manually merged commit dd9720a030 into main 2026-12-03 18:36:13 +00:00
xrobau deleted branch fast-builder 2026-12-03 18:37:46 +00:00
Sign in to join this conversation.
No reviewers
No labels
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
TrustNo1/Darner!21
No description provided.