perf(release): reuse the last release's unchanged pack members, no dist debug info, stored uploads, Windows downloads kept #2597
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/mods
area/renderer
area/saves
area/tooling
area/upscaling
beanstalk: approved
beanstalk: failed
beanstalk: needs approval
beanstalk: running
beanstalk: tested
ci: approved
good first issue
gpu/amd
gpu/igpu
gpu/intel
gpu/nvidia
help wanted
kind
bug
kind
chore
kind
docs
kind
feature
kind
performance
kind
question
needs measurements
platform/linux
platform/macos
platform/steam-deck
platform/windows
preview
priority
critical
priority
high
priority
low
regression
risk
high
risk
low
risk
medium
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!2597
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:push-uzmnkvwoqrrs"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 sources7.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:
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 zstdskippable frame holding its key: SHA-256 over the zstd program's
-V,MEMBER_ZSTDand the SHA-256 of themember'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-objectsalready downloads the newest signed nightly and checks itsSHA256SUMS.sig. It now also keeps thatrelease's whole pack (
<out>/sources.pack,release_objects.rs).dev release sources --reuse <pack>takes amember 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 -T1per member, as many at once as the CPU count, then put into the pack in member order, sothe output is deterministic. Both workflows pass
--reuse "$RUNNER_TEMP/last-objects/sources.pack".debug = false;strip = "debuginfo"stays, to remove what stdships). The symbols stay, so a panic backtrace still names its functions (no file or line).
compression-level: 0on everydist/upload (the program is mostly its zstdpack, 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.
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) andthird_party/renhdrum/Cargo.lock, and so does the Linuxkey. 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.rswrite_with/reuse_of,release_objects.rstake,release_cmd.rssources_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:--reusewired, downloads saved before the pack, upload levels),test_renhdrum.py,test_recomplauncher_json.py,test_linux_docker_packages.py,test_doc_anchors.py: pass.maintoo, in files this PR does not touch:cargo fmt --check(site_hooks.rs) andtest_windows_on_linux.py'sci.ymlrenderer count (3, not 2).Still to test:
dev release sourcesto 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).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 areexpected, not yet measured on the runner.
Setup: this PC (24 threads,
-j 8),cargo build --locked --profile dist -p longshot-builderfor the host. "Before"is main's effective profile (
CARGO_PROFILE_DIST_DEBUG=line-tables-only), "after" is this PR. Each build ran cold inits own target folder, then warm after touching every workspace
.rsfile. One run each, in one queue job..debug_*sectionsbuild_driver::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
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 -dskips the frame.full decompress-and-compare. A wrong reuse would need all four to be fooled. Without
--reuse, or with a pack thatcan't be read, everything is compressed as before.
strip = "debuginfo"already removed the line tables from the shippedprogram, so its backtraces had function names only, and they still do.
Checklist
Ready for review
main; the title is a Conventional Commit.mise run testpasses (any failure that also fails onmainis named). (CI runs it; the two failures above are onmaintoo.)main, or Measurements says why there is nothing to measure.third_party/untouched; nothing GPL-incompatible.When it applies
tests/that reads changed source is updated, not weakened.Assisted-by:/Co-Authored-By:trailers.Ready to merge
main, measured again or a comment says why the numbers still hold.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e1RP1VgcWpgA7Kq6ec
WIP: perf(release): reuse the last release's unchanged pack members, no dist debug info, stored uploads, Windows downloads keptto perf(release): reuse the last release's unchanged pack members, no dist debug info, stored uploads, Windows downloads kept