perf(release): reuse the last release's unchanged pack members, no dist debug info, stored uploads, Windows downloads kept #2597

Merged
HumanBean merged 2 commits from HumanBean/Longshot:push-uzmnkvwoqrrs into main 2026-11-26 04:58:47 +00:00
Owner

Summary

A nightly's build jobs spend most of their time recompressing what did not change, compiling debug info that is
thrown away, zipping already-compressed files, and (Windows) downloading the Rust toolchain and ~400 crates again.
Run 54856 (nightly-829): Linux 29.5 min; dev release sources 7.9 min, the dist compile 7.5 min, uploads ~3.4 min;
Windows another ~4 min of downloads. This changes four things, all in the release build jobs:

  1. The pack reuses the last release's unchanged members (builder/crates/build-driver/src/sources.rs:
    write_with, member_key, key_frame, reuse_of). Every member of a release's pack now ends with a zstd
    skippable frame holding its key: SHA-256 over the zstd program's -V, MEMBER_ZSTD and the SHA-256 of the
    member's raw bytes. (The pack table's SHA-256 covers the compressed bytes, so it can't serve as the key.) Every zstd
    reader skips such a frame, and this format's reader never reads past a member's last file. dev release last-objects already downloads the newest signed nightly and checks its SHA256SUMS.sig. It now also keeps that
    release's whole pack (<out>/sources.pack, release_objects.rs). dev release sources --reuse <pack> takes a
    member from it only when its name and key match this build's and its frame, decompressed, equals this member's raw
    bytes compared whole. The result is the same bytes fresh compression would give. Anything not reused is compressed
    by a pool, one zstd -T1 per member, as many at once as the CPU count, then put into the pack in member order, so
    the output is deterministic. Both workflows pass --reuse "$RUNNER_TEMP/last-objects/sources.pack".
  2. The dist profile generates no debug info (debug = false; strip = "debuginfo" stays, to remove what std
    ships). The symbols stay, so a panic backtrace still names its functions (no file or line).
  3. Uploads are stored, not zipped: compression-level: 0 on every dist/ upload (the program is mostly its zstd
    pack, the deltas are zstd, RecompLauncher's zip holds the program). The Linux tool, a plain ELF, is zipped at level
    1 (43 % of its size in 0.4 s here, against 39 % in 1.4 s at level 6). The retry and direct-address steps are
    unchanged.
  4. The release downloads are saved right after the last download, not at the job's end. That is after RenHDrum's
    build on Linux, and after the program's compile on Windows (after the game's Rust, RenHDrum and the builder, before
    the Wine checks and deltas, which failed in several recent Windows runs). The Windows key now also hashes
    builder/tools/pins.sh (llvm-mingw, which it caches) and third_party/renhdrum/Cargo.lock, and so does the Linux
    key. Main-and-tags-only restores and saves are unchanged. Honest caveat: I could not read run 54856's Windows log
    through the API, so "a failing later step left no entry" is my reading of the workflow and the run history (Windows
    failed or was cancelled in 54332, 54507 and 54764), not something I saw in the log.

Read first: sources.rs write_with/reuse_of, release_objects.rs take, release_cmd.rs sources_cmd.
Docs: docs/dev/reference/releases.md (new bullets), docs/dev/reference/ci.md (The release's cache).

Testing

Tested: Linux (CachyOS), this PC (the change runs in CI, not in the game). One dev.py queue run --mode build:

  • cargo test -p build-driver --lib sources::: 25 passed. The new tests: a_reused_member_is_the_bytes_compressing_it_again_gives, a_changed_member_or_other_settings_are_compressed_again (also: another zstd version gives no reuse, and a key frame over another member's frame is refused), members_made_at_once_give_the_bytes_of_one_after_another (1, 2, 3, 8, 64 jobs give the same bytes).
  • cargo test -p longshot-builder -- release_: 26 passed (last-objects keeps the pack of a signed release, and none of a refused one).
  • cargo clippy -p build-driver -p longshot-builder --all-targets -- -D warnings: clean.
  • tests/test_release_workflow.py (with a new check: --reuse wired, downloads saved before the pack, upload levels), test_renhdrum.py, test_recomplauncher_json.py, test_linux_docker_packages.py, test_doc_anchors.py: pass.
  • Two failures that are on main too, in files this PR does not touch: cargo fmt --check (site_hooks.rs) and test_windows_on_linux.py's ci.yml renderer count (3, not 2).

Still to test:

  • The release runner: the first nightly after merge, expecting dev release sources to say "0 members taken from the last pack" (nightly-829's pack has no key frames) and compress them at once (2 at a time on 2 cores). The nightly after that should say most members (the tools) are taken, with the step at seconds plus the source members. Read from the nightly's logs (by hand).
  • The Windows job: the downloads saved after its compile, and the next nightly's RenHDrum and game-Rust steps fetching nothing (by hand, from the logs).

Measurements

Verdict: the dist compile without debug info: a cold compile 90 s → 75 s (−17 %) on this PC. The one warm run
(workspace crates rebuilt) went the other way, 33.5 s → 55.1 s, on a busy PC (a shared game job was running), so
there is no evidence for a warm gain here; the release runner's numbers will tell. The program is the same size
(34.84 MB both ways), because strip = "debuginfo" already removed the line tables. The pack and upload savings are
expected, not yet measured on the runner.

Setup: this PC (24 threads, -j 8), cargo build --locked --profile dist -p longshot-builder for the host. "Before"
is main's effective profile (CARGO_PROFILE_DIST_DEBUG=line-tables-only), "after" is this PR. Each build ran cold in
its own target folder, then warm after touching every workspace .rs file. One run each, in one queue job.

Before: main's profile After: this PR
dist compile, cold 1m 30s 1m 15s
dist compile, warm (one run, noisy) 33.5 s 55.1 s
program size 34,835,512 B 34,841,360 B
.debug_* sections 1 0
symbols naming build_driver:: 1099 1100

Expected on the release runner (Linux job, 29.5 min in 54856): sources 7.9 min → about 4 min on the first nightly
(2 members at once), then under a minute once the tools are reused. Uploads 3.4 min → well under a minute (nothing to
deflate). Dist compile: some saving, size unknown until the runner shows it. Windows: about 4 min less once its
downloads entry exists, plus the same pack and upload savings.

Risks

  • Every member of a release's pack gains 40 bytes (the key frame), so each member's bytes, and the tree's hash, change
    once. Players unpack the new tree once; the deltas from older releases grow once. Older builders read the new packs
    (they never read past a member's last file), and zstd -d skips the frame.
  • A reused member is the previous signed release's bytes, checked by its signature, its table SHA-256, the key, and a
    full decompress-and-compare. A wrong reuse would need all four to be fooled. Without --reuse, or with a pack that
    can't be read, everything is compressed as before.
  • Several zstd -19 processes at once on the 2-core runner: about twice the peak memory of the old serial pack.
  • Backtraces: nothing changes for players. strip = "debuginfo" already removed the line tables from the shipped
    program, so its backtraces had function names only, and they still do.
  • Revert is enough to undo any of it.

Checklist

Ready for review

  • One topic, on current main; the title is a Conventional Commit.
  • Tested on my own PC, in the game for a change the game runs, as Testing says. (No game change: release CI only; its checks ran here.)
  • mise run test passes (any failure that also fails on main is named). (CI runs it; the two failures above are on main too.)
  • Measured against main, or Measurements says why there is nothing to measure.
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A check under tests/ that reads changed source is updated, not weakened.
  • Docs updated.
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

Ready to merge

  • Everything in Still to test has run, its results in Tested.
  • Approved in review, every comment answered.
  • CI passes on the head; on current main, measured again or a comment says why the numbers still hold.

🤖 Generated with Claude Code

https://claude.ai/code/session_017vw8e1RP1VgcWpgA7Kq6ec

## Summary A nightly's build jobs spend most of their time recompressing what did not change, compiling debug info that is thrown away, zipping already-compressed files, and (Windows) downloading the Rust toolchain and ~400 crates again. Run 54856 (nightly-829): Linux 29.5 min; `dev release sources` 7.9 min, the dist compile 7.5 min, uploads ~3.4 min; Windows another ~4 min of downloads. This changes four things, all in the release build jobs: 1. **The pack reuses the last release's unchanged members** (`builder/crates/build-driver/src/sources.rs`: `write_with`, `member_key`, `key_frame`, `reuse_of`). Every member of a release's pack now ends with a zstd skippable frame holding its key: SHA-256 over the zstd program's `-V`, `MEMBER_ZSTD` and the SHA-256 of the member's raw bytes. (The pack table's SHA-256 covers the compressed bytes, so it can't serve as the key.) Every zstd reader skips such a frame, and this format's reader never reads past a member's last file. `dev release last-objects` already downloads the newest signed nightly and checks its `SHA256SUMS.sig`. It now also keeps that release's whole pack (`<out>/sources.pack`, `release_objects.rs`). `dev release sources --reuse <pack>` takes a member from it only when its name and key match this build's and its frame, decompressed, equals this member's raw bytes compared whole. The result is the same bytes fresh compression would give. Anything not reused is compressed by a pool, one `zstd -T1` per member, as many at once as the CPU count, then put into the pack in member order, so the output is deterministic. Both workflows pass `--reuse "$RUNNER_TEMP/last-objects/sources.pack"`. 2. **The dist profile generates no debug info** (`debug = false`; `strip = "debuginfo"` stays, to remove what std ships). The symbols stay, so a panic backtrace still names its functions (no file or line). 3. **Uploads are stored, not zipped:** `compression-level: 0` on every `dist/` upload (the program is mostly its zstd pack, the deltas are zstd, RecompLauncher's zip holds the program). The Linux tool, a plain ELF, is zipped at level 1 (43 % of its size in 0.4 s here, against 39 % in 1.4 s at level 6). The retry and direct-address steps are unchanged. 4. **The release downloads are saved right after the last download**, not at the job's end. That is after RenHDrum's build on Linux, and after the program's compile on Windows (after the game's Rust, RenHDrum and the builder, before the Wine checks and deltas, which failed in several recent Windows runs). The Windows key now also hashes `builder/tools/pins.sh` (llvm-mingw, which it caches) and `third_party/renhdrum/Cargo.lock`, and so does the Linux key. Main-and-tags-only restores and saves are unchanged. Honest caveat: I could not read run 54856's Windows log through the API, so "a failing later step left no entry" is my reading of the workflow and the run history (Windows failed or was cancelled in 54332, 54507 and 54764), not something I saw in the log. Read first: `sources.rs` `write_with`/`reuse_of`, `release_objects.rs` `take`, `release_cmd.rs` `sources_cmd`. Docs: `docs/dev/reference/releases.md` (new bullets), `docs/dev/reference/ci.md` (The release's cache). ## Testing **Tested:** Linux (CachyOS), this PC (the change runs in CI, not in the game). One `dev.py queue run --mode build`: - `cargo test -p build-driver --lib sources::`: 25 passed. The new tests: `a_reused_member_is_the_bytes_compressing_it_again_gives`, `a_changed_member_or_other_settings_are_compressed_again` (also: another zstd version gives no reuse, and a key frame over another member's frame is refused), `members_made_at_once_give_the_bytes_of_one_after_another` (1, 2, 3, 8, 64 jobs give the same bytes). - `cargo test -p longshot-builder -- release_`: 26 passed (last-objects keeps the pack of a signed release, and none of a refused one). - `cargo clippy -p build-driver -p longshot-builder --all-targets -- -D warnings`: clean. - `tests/test_release_workflow.py` (with a new check: `--reuse` wired, downloads saved before the pack, upload levels), `test_renhdrum.py`, `test_recomplauncher_json.py`, `test_linux_docker_packages.py`, `test_doc_anchors.py`: pass. - Two failures that are on `main` too, in files this PR does not touch: `cargo fmt --check` (`site_hooks.rs`) and `test_windows_on_linux.py`'s `ci.yml` renderer count (3, not 2). **Still to test:** - The release runner: the first nightly after merge, expecting `dev release sources` to say "0 members taken from the last pack" (nightly-829's pack has no key frames) and compress them at once (2 at a time on 2 cores). The nightly after that should say most members (the tools) are taken, with the step at seconds plus the source members. Read from the nightly's logs (by hand). - The Windows job: the downloads saved after its compile, and the next nightly's RenHDrum and game-Rust steps fetching nothing (by hand, from the logs). ## Measurements **Verdict:** the dist compile without debug info: a cold compile 90 s → 75 s (−17 %) on this PC. The one warm run (workspace crates rebuilt) went the other way, 33.5 s → 55.1 s, on a busy PC (a shared game job was running), so there is no evidence for a warm gain here; the release runner's numbers will tell. The program is the same size (34.84 MB both ways), because `strip = "debuginfo"` already removed the line tables. The pack and upload savings are expected, not yet measured on the runner. Setup: this PC (24 threads, `-j 8`), `cargo build --locked --profile dist -p longshot-builder` for the host. "Before" is main's effective profile (`CARGO_PROFILE_DIST_DEBUG=line-tables-only`), "after" is this PR. Each build ran cold in its own target folder, then warm after touching every workspace `.rs` file. One run each, in one queue job. | | Before: main's profile | After: this PR | |---|---|---| | dist compile, cold | 1m 30s | 1m 15s | | dist compile, warm (one run, noisy) | 33.5 s | 55.1 s | | program size | 34,835,512 B | 34,841,360 B | | `.debug_*` sections | 1 | 0 | | symbols naming `build_driver::` | 1099 | 1100 | Expected on the release runner (Linux job, 29.5 min in 54856): sources 7.9 min → about 4 min on the first nightly (2 members at once), then under a minute once the tools are reused. Uploads 3.4 min → well under a minute (nothing to deflate). Dist compile: some saving, size unknown until the runner shows it. Windows: about 4 min less once its downloads entry exists, plus the same pack and upload savings. ## Risks - Every member of a release's pack gains 40 bytes (the key frame), so each member's bytes, and the tree's hash, change once. Players unpack the new tree once; the deltas from older releases grow once. Older builders read the new packs (they never read past a member's last file), and `zstd -d` skips the frame. - A reused member is the previous signed release's bytes, checked by its signature, its table SHA-256, the key, and a full decompress-and-compare. A wrong reuse would need all four to be fooled. Without `--reuse`, or with a pack that can't be read, everything is compressed as before. - Several zstd -19 processes at once on the 2-core runner: about twice the peak memory of the old serial pack. - Backtraces: nothing changes for players. `strip = "debuginfo"` already removed the line tables from the shipped program, so its backtraces had function names only, and they still do. - Revert is enough to undo any of it. ## Checklist ### Ready for review - [x] One topic, on current `main`; the title is a Conventional Commit. - [x] Tested on my own PC, in the game for a change the game runs, as Testing says. (No game change: release CI only; its checks ran here.) - [ ] `mise run test` passes (any failure that also fails on `main` is named). (CI runs it; the two failures above are on `main` too.) - [x] Measured against `main`, or Measurements says why there is nothing to measure. - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [x] A check under `tests/` that reads changed source is updated, not weakened. - [x] Docs updated. - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. ### Ready to merge - [ ] Everything in Still to test has run, its results in Tested. - [ ] Approved in review, every comment answered. - [ ] CI passes on the head; on current `main`, measured again or a comment says why the numbers still hold. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_017vw8e1RP1VgcWpgA7Kq6ec
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e1RP1VgcWpgA7Kq6ec
perf(release): the pack takes the last release's unchanged members, compresses the rest at once; stored uploads; Windows keeps its downloads
Some checks failed
Website / Website preview, upload (pull_request_target) Has been skipped
Website / Website on Cloudflare (pull_request_target) Has been skipped
Website / Website preview, built by CI (pull_request_target) Has been skipped
CI / What the change needs (pull_request) Successful in 25s
CI / Third-party parts and guide screenshots (pull_request) Successful in 30s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 2m30s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 2m39s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 3m11s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Failing after 4m57s
CI / Website build and checks (pull_request) Successful in 3m18s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 8m42s
PR description / Title and description (pull_request_target) Failing after 8s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 9m21s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Successful in 18m34s
3af48debe6
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017vw8e1RP1VgcWpgA7Kq6ec
HumanBean changed title from WIP: perf(release): reuse the last release's unchanged pack members, no dist debug info, stored uploads, Windows downloads kept to perf(release): reuse the last release's unchanged pack members, no dist debug info, stored uploads, Windows downloads kept 2026-11-26 04:58:38 +00:00
HumanBean deleted branch push-uzmnkvwoqrrs 2026-11-26 04:58:48 +00:00
Sign in to join this conversation.
No reviewers
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
MagicBeanDev/Longshot!2597
No description provided.