perf(build): the release ships the third-party code compiled, so a player's build links it instead of compiling it #629
No reviewers
Labels
No labels
area/accessibility
area/audio
area/input
area/install
area/menu
area/renderer
area/saves
area/upscaling
beanstalk: approved @ 1697603
beanstalk: approved @ 2c5a62e
beanstalk: approved @ 4fd82b7
beanstalk: approved @ 64d6d09
beanstalk: approved @ 6f91fae
beanstalk: approved @ 70a78f9
beanstalk: approved @ 8d361dc
beanstalk: approved @ 9d8356e
beanstalk: approved @ abf2227
beanstalk: approved @ d82f202
beanstalk: approved @ e5f1e40
beanstalk: approved @ ee8ab5f
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
status
blocked
status
confirmed
status
duplicate
status
invalid
status
needs-info
status
wontfix
testing wanted
ci: approved
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
MagicBeanDev/Longshot!629
Loading…
Reference in a new issue
No description provided.
Delete branch "HumanBean/Longshot:perf/third-party-objects"
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?
Type: perf · Risk: medium · Tested on: Linux, i7-9700K lab (headless) · Needs: Windows: a release build's log, and a player's first build with it
Why
A player's first build, and every build after a change that empties the work folder's object cache, compiles about 315 third-party files (Eden's shader recompiler, sirit, Dear ImGui, zstd, libopus; on Windows also suyu's code under the WebGPU renderer). These are the same on every PC with the same compiler, so the release can compile them once and the player's build can link them. On the lab it cut a first build's compile count from 488 to 172 files. See #362 (a faster first build) and #182 (
-march=native, which this keeps for everything but the third-party code).What changed
The release makes a set of compiled third-party objects with the tools a player's build uses. A player's build copies each object whose object key it needs into its object cache, checking the object's SHA-256, and compiles anything it can't find, as before. These objects' keys also hold a stamp: the compiler's version, its driver defaults, and what the system headers, the C++ library and the Vulkan/SPIR-V/VMA headers preprocess to. A set made with another compiler or other headers is never used.
nx2/third_party_objects.py:stamp(),fetch()(copies and checks the SHA-256 and size),write(),matching(),is_third_party()(theSOURCESfolders), andmake <out>.makerunsbuild.py --standalone --third-party-objects <out>atRX_MARCH=x86-64-v3with no game.nx2/build.py:THIRD_PARTY_CPUbuilds the third-party code at-march=x86-64-v3on any CPU that has v3, notnative, so its keys don't name the CPU. Below v3, or with anRX_MARCH, it builds like the rest. The third-party jobs' deps end with the stamp, and they are built without-DLONGSHOT_RELEASE, which none of them reads. The set is fetched before the compile, and the dry run reportsthe third-party objects: N of M. The renderer's owngpu/vk/*.cpp(DLSS, FSR 4, the play profile),host/and the lifted game are never in the set.scripts/linux/appimage.shmakes the set intousr/share/longshot/third_party_objects.scripts/linux/check_player_build.shfails unless the player's dry run finds N of N..forgejo/workflows/build-windows.ymlmakes the Windows set (the same llvm-mingw release's Linux build, tools.lock's cpm and wgpu-native).scripts/builder_package.py package --third-party-objectsputs it intools/third_party_objects.docs/development.md(LONGSHOT_THIRD_PARTY_OBJECTS, and theRX_MARCHrow),docs/releases.md(what the release files hold).tests/test_third_party_objects.py;tests/test_shader_stamp_cache.pyupdated for the new flags and keys.Measurements
Verdict: Helps a little on Linux. A first build compiled 172 of 488 files instead of 488, and took 848 s against 908 s (−7 %, one run each way). A renderer-only build took 16 s against 55 s. The lifted game is about 94 % of the compile's CPU time, so the gain is capped at that. On Windows it is not measured.
Hardware: Linux, i7-9700K (8 cores), 6 jobs, SCHED_IDLE under the lab's build lock; tools.lock's linux-x64 clang, sysroot and CPM headers
Scene: none (the build)
Method: a full first build in fresh work and game folders, one run each way. The Vulkan back end alone (
RX_VK_ONLY=1) in a fresh work folder, twice each way. Each figure is build.py's owncompiled intime and make_game.py's total.How to reproduce:
python -I nx2/third_party_objects.py make <set>, then a first build withLONGSHOT_THIRD_PARTY_OBJECTS=<set>against one with=02b1d38c65902f062, rebased)longshot_vk.sois identical either way.RX_MARCH=x86-64-v2LONGSHOT_THIRD_PARTY_OBJECTS=0Flags and settings
One new development switch, no player setting.
LONGSHOT_THIRD_PARTY_OBJECTSthird_party_objects/(a checkout has none)0compiles them all;<dir>uses that setTesting
Tested: on the lab (Linux, i7-9700K): making the set; a first build and a renderer-only build each way; byte-identical objects; the four mismatches above; the after game's headless start.
tests/run_all.pywith the before and after trees on the lab shows the same 15 failures in both (many because the lab copies have no.git). The after tree has 501 passing against 500.test_appimage_player_build.py'stest_no_prebuilt_rendereralready fails on main. Nothing was run on the author's PC.Not tested: Windows, entirely: the CI step that makes the set with llvm-mingw, cpm and wgpu-native, and whether the Linux-hosted and Windows-hosted llvm-mingw 20261104 give the same stamp. If they don't, Windows players compile as before and the build log says "0 of N". The WebGPU suyu objects.
appimage.shandcheck_player_build.shend to end (the lab used the samemakewith tools.lock's tools).Must be tested:
check_player_build.shmust pass (it requires N of N), and a player's first build log must saythe third-party objects: N of N from ….the third-party objects: N of Mshould say N = M. 0 means the stamps differ.Risks
host/posixheaders or the-Iorder beyondMKWVK_INCLUDES. A set made from the same release tree is not affected.LONGSHOT_THIRD_PARTY_OBJECTS=0turns it off without a revert.Issues
See #362
Checklist
Everyone
type(scope): description) of the status line's type.main.python -I -B tests/run_all.pypasses (any failure that also fails onmainis named). (run on the lab only, same 15 failures as main; left to CI)third_party/untouched (a new folder with aPROVENANCE.mdinstead).When it applies
Assisted-by:/Co-Authored-By:trailers.tests/that reads changed source updated in this PR, not weakened.🤖 Generated with Claude Code
https://claude.ai/code/session_017vw8e3MfaADZobPGhWJk77
WIP: perf(build): the release ships the third-party code compiled, so a player's build links it instead of compiling itto perf(build): the release ships the third-party code compiled, so a player's build links it instead of compiling itdyst referenced this pull request2026-11-15 03:41:17 +00:00
dyst referenced this pull request2026-11-15 03:41:19 +00:00
mooki referenced this pull request2026-11-15 07:01:45 +00:00