perf(build): the chunks an all-O2 build compiles are cut into parts #1431

Merged
HumanBean merged 4 commits from Marcuss2/Longshot:perf/build-o2-chunks into main 2026-11-17 21:51:37 +00:00
Contributor

Type: perf · Risk: low · Tested on: Linux (RADV, RX 9070 XT) · Needs: none

Why

LONGSHOT_CHUNK_OPT=all builds every lifted chunk at -O2. A 25 MB chunk's -O2 passes cost more than linearly in its
functions' sizes (GVN alone was 43-46% of one chunk's compile here), and 32 of them at once contend for memory
bandwidth: from scratch on one lift the build took 23:06, its longest single compile 960 s. The lift already splits a
chunk whose cost is past a plain one's (chunks.split_big); this splits it again where the build compiles it.

What changed

The build cuts each chunk it sends to -O2 at function starts into parts of about LONGSHOT_CHUNK_PART_MB (6) MB of
estimated compile cost, each with the chunk's declarations and each its own object. The lifted C is not changed; the
parts are written to <build>/split with a stamp, so a build that changed nothing writes nothing. --kept-lift builds
are not cut. LONGSHOT_CHUNK_LEVEL (default O2; O1, O2 or O3) is the level those chunks compile at.

  • nx2/build.py: chunk_opt_o2 (the selection), chunk_level and chunk_flags (the level, no light flags),
    chunk_parts (the cut, chunks._cut), chunk_split_flag (the cut in the object key); main expands a selected
    chunk's job into its parts and skips write_kept for a cut build.
  • docs/development.md: the three switches and "An all-O2 build".
  • tests/test_chunk_parts.py: the cut, the functions and declarations, the stamp, the selection and the levels, game-free.

Measurements

Verdict: yes. Against main's default (the hot list's functions at -O2, the rest -O1), the all-O2 build is
+4.4% fps at Link's house for +2:03 of build; the cut is what makes that build 5:00 instead of 23:06 (whole
chunks). -O3 is within noise of -O2 in the scene and costs the same build time.

Main's default is not all-O1: the lift puts the hot list's functions in code_hot_*.c, compiled at -O2. The
comparison uses the 47-function list from the opt-budget report (the shipped profile is not in this checkout; the
shipped list is larger, which would make main's default a little slower to build and a little faster in the game, but
not change the direction).

A three-way run on the PR's base: main @ 67efc4d3, the same lift (89 files, 1.4 GB of C, 8 hot pieces), the same PC,
one build at a time, from scratch in a fresh work folder.

Hardware: Linux, AMD Ryzen 9 9950X3D (16 cores, 32 threads), 62 GB, NVMe, RADV RX 9070 XT.
Scene: none (the build alone).
Method: OOT_WORK=<work> [LONGSHOT_CHUNK_OPT=all [LONGSHOT_CHUNK_LEVEL=O2|O3 [RX_HOT_OPT=O3]]] python3 -I nx2/build.py --standalone --jobs 32,
nothing else running.
How to reproduce: from a fresh work folder with the hot-list lift (OOT_WORK=<work>), run the Method line on main for
the first column, and on this branch with LONGSHOT_CHUNK_OPT=all and LONGSHOT_CHUNK_LEVEL=O2 or O3 for the
others. The logs are hot-main.log, hot-o2.log and hot-o3.log in the checkout's work/investigations/ (not
committed: build output).

Before: main @ 67efc4d3, default (hot pieces -O2) After: this PR @ c2f3e5b5, -O2 After: this PR @ c2f3e5b5, -O3
whole build 2:57 5:00 5:00
compile 170 s 291 s 292 s
the lifted compiles, summed 4,310 s in 89 files (hot pieces 226 s) 8,302 s in 349 files (hot pieces 234 s) 8,334 s in 349 files (hot pieces 250 s)
longest single compile 76 s (a hot piece) 75 s (a hot piece) 78 s (a hot piece)
longshot 534,542,688 B 511,039,976 B 522,315,624 B

The cut's own effect, measured on 544229a2 without a hot list: the same all-O2 build without the cut (whole chunks)
took 23:06 (compile 1,384 s, 31,675 s of lifted compiles, longest 960 s), and with the cut 4:37 (268 s, 7,859 s,
longest 91 s). The hot list adds its own pieces at -O2 (226-250 s here).

The per-chunk probe (one compile at a time): code_022.c 133 -> 87 s in 4 parts (its longest compile 133 -> 28 s),
code_008.c 162 -> 73 s, code_000.c 39 -> 26 s; the objects are the same size.

In the game

Link's house (the repository save kokiri-start), standing still, 20 s warm-up then the control bridge's fps once a
second for 40 s; four interleaved runs each, the median of the 160 samples. Same PC, 2560x1440, the game's own
upscaler, HOS_DYNRES=0, HOS_FPS_MAX=1000, headless, audio off.

Before: main default @ 67efc4d3, hot pieces -O2 After: this PR @ c2f3e5b5, -O2 After: this PR @ c2f3e5b5, -O3
fps, median of 160 samples 91.8 95.8 95.8
per-run medians 88.9, 91.8, 91.8, 92.9 92.8, 95.8, 95.8, 95.8 95.8, 95.8, 95.8, 95.8

The all-O2 build is 4.4% faster than main's default; -O3 is within noise of it (0.0%). The first runs of the session
were slower (the GPU's clocks ramp): the interleaved later runs are main 92.9, -O2 95.8, -O3 95.8. The runs had
occasional hitches (12.8-45.4 fps in one sample), which the median ignores.

Flags and settings

Three build switches, all compile-only and off by default:

Flag What it is Before this PR After this PR Effect Recommendation
LONGSHOT_CHUNK_OPT=all or <file> The lifted chunks at the level below (all, or the ones a file names) absent as the opt-budget report proposed the game's lifted code at -O2/-O3 opt-in: an experiment or a quality build
LONGSHOT_CHUNK_LEVEL=<level> The level its chunks compile at (O1, O2 or O3; default O2) absent O2 -O3 gives no fps over -O2 here O2; O3 only for a scene A/B
LONGSHOT_CHUNK_PART_MB=<MB> The parts a chunk sent to the level above is cut into (default 6; 0: whole chunks) absent 6 the cut above keep 6

Testing

Tested: python3 -I -B tests/run_all.py --jobs 8: 609 passed, 36 failed, 77 skipped; the same failures (and 2 more)
fail on clean origin/main @ 544229a2 here (606 passed, 38 failed), so no new failure. tests/test_chunk_parts.py
passes. In the game (Linux, RADV, RX 9070 XT), Link's house from the repository save kokiri-start, standing still:
91.8 fps on main's default (hot list at -O2), 95.8 on this branch at -O2 and 95.8 at -O3 (four interleaved
runs each, the median of 160 samples); no crash or assertion. The three docs/tested/ files have the runs.

Not tested: Windows.

Must be tested: none.

Risks

What could break: the parts compile to the same functions but the inliner sees one part at a time, so the code
layout differs slightly (the exe is 23.5 MB smaller at -O2, 11.3 MB larger at -O3 than main's default). The hot
pieces are not cut, so the game's hot path is unchanged. A chunk whose text the cut refuses stays whole.

Turning it off: LONGSHOT_CHUNK_PART_MB=0 (or unset LONGSHOT_CHUNK_OPT).

Compatibility: nothing for players: LONGSHOT_CHUNK_OPT is opt-in, and a release build sets neither switch.

Checklist

Everyone

  • One topic.
  • The title is a Conventional Commit (type(scope): description) of the status line's type.
  • Why gives the reason plainly and links the issues that fit (none).
  • Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what
    can't be run by hand is in Testing's Not testable by hand, with why.
  • Measurements has a verdict and the table.
  • Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and
    in Risks.
  • Testing names what was tested, what wasn't, and what must still be tested.
  • Rebased on current main (67efc4d3).
  • python -I -B tests/run_all.py passes (the failures are pre-existing; named above).
  • No game files, dumps, build output or generated files.
  • third_party/ untouched (a new folder with a PROVENANCE.md instead).
  • The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled.

When it applies

  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.
  • Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (From-scratch builds cannot be interleaved cheaply: one build each of 2:57, 5:00 and 5:00; the effect is far outside the run-to-run spread. The fps runs are four interleaved runs each.)
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A game-free test added for the fix, failing on main and passing here.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.
**Type:** perf · **Risk:** low · **Tested on:** Linux (RADV, RX 9070 XT) · **Needs:** none ## Why `LONGSHOT_CHUNK_OPT=all` builds every lifted chunk at `-O2`. A 25 MB chunk's `-O2` passes cost more than linearly in its functions' sizes (GVN alone was 43-46% of one chunk's compile here), and 32 of them at once contend for memory bandwidth: from scratch on one lift the build took 23:06, its longest single compile 960 s. The lift already splits a chunk whose cost is past a plain one's (`chunks.split_big`); this splits it again where the build compiles it. ## What changed The build cuts each chunk it sends to `-O2` at function starts into parts of about `LONGSHOT_CHUNK_PART_MB` (6) MB of estimated compile cost, each with the chunk's declarations and each its own object. The lifted C is not changed; the parts are written to `<build>/split` with a stamp, so a build that changed nothing writes nothing. `--kept-lift` builds are not cut. `LONGSHOT_CHUNK_LEVEL` (default `O2`; `O1`, `O2` or `O3`) is the level those chunks compile at. - `nx2/build.py`: `chunk_opt_o2` (the selection), `chunk_level` and `chunk_flags` (the level, no light flags), `chunk_parts` (the cut, `chunks._cut`), `chunk_split_flag` (the cut in the object key); `main` expands a selected chunk's job into its parts and skips `write_kept` for a cut build. - `docs/development.md`: the three switches and "An all-O2 build". - `tests/test_chunk_parts.py`: the cut, the functions and declarations, the stamp, the selection and the levels, game-free. ## Measurements **Verdict:** yes. Against main's default (the hot list's functions at `-O2`, the rest `-O1`), the all-`O2` build is **+4.4% fps** at Link's house for **+2:03** of build; the cut is what makes that build 5:00 instead of 23:06 (whole chunks). `-O3` is within noise of `-O2` in the scene and costs the same build time. Main's default is not all-`O1`: the lift puts the hot list's functions in `code_hot_*.c`, compiled at `-O2`. The comparison uses the 47-function list from the opt-budget report (the shipped profile is not in this checkout; the shipped list is larger, which would make main's default a little slower to build and a little faster in the game, but not change the direction). A three-way run on the PR's base: main @ 67efc4d3, the same lift (89 files, 1.4 GB of C, 8 hot pieces), the same PC, one build at a time, from scratch in a fresh work folder. Hardware: Linux, AMD Ryzen 9 9950X3D (16 cores, 32 threads), 62 GB, NVMe, RADV RX 9070 XT. Scene: none (the build alone). Method: `OOT_WORK=<work> [LONGSHOT_CHUNK_OPT=all [LONGSHOT_CHUNK_LEVEL=O2|O3 [RX_HOT_OPT=O3]]] python3 -I nx2/build.py --standalone --jobs 32`, nothing else running. How to reproduce: from a fresh work folder with the hot-list lift (`OOT_WORK=<work>`), run the Method line on main for the first column, and on this branch with `LONGSHOT_CHUNK_OPT=all` and `LONGSHOT_CHUNK_LEVEL=O2` or `O3` for the others. The logs are `hot-main.log`, `hot-o2.log` and `hot-o3.log` in the checkout's `work/investigations/` (not committed: build output). | | Before: main @ 67efc4d3, default (hot pieces `-O2`) | After: this PR @ c2f3e5b5, `-O2` | After: this PR @ c2f3e5b5, `-O3` | |---|---|---|---| | whole build | **2:57** | **5:00** | **5:00** | | compile | 170 s | 291 s | 292 s | | the lifted compiles, summed | 4,310 s in 89 files (hot pieces 226 s) | 8,302 s in 349 files (hot pieces 234 s) | 8,334 s in 349 files (hot pieces 250 s) | | longest single compile | 76 s (a hot piece) | 75 s (a hot piece) | 78 s (a hot piece) | | `longshot` | 534,542,688 B | 511,039,976 B | 522,315,624 B | The cut's own effect, measured on 544229a2 without a hot list: the same all-`O2` build without the cut (whole chunks) took **23:06** (compile 1,384 s, 31,675 s of lifted compiles, longest 960 s), and with the cut **4:37** (268 s, 7,859 s, longest 91 s). The hot list adds its own pieces at `-O2` (226-250 s here). The per-chunk probe (one compile at a time): `code_022.c` 133 -> 87 s in 4 parts (its longest compile 133 -> 28 s), `code_008.c` 162 -> 73 s, `code_000.c` 39 -> 26 s; the objects are the same size. ### In the game Link's house (the repository save `kokiri-start`), standing still, 20 s warm-up then the control bridge's fps once a second for 40 s; four interleaved runs each, the median of the 160 samples. Same PC, 2560x1440, the game's own upscaler, `HOS_DYNRES=0`, `HOS_FPS_MAX=1000`, headless, audio off. | | Before: main default @ 67efc4d3, hot pieces `-O2` | After: this PR @ c2f3e5b5, `-O2` | After: this PR @ c2f3e5b5, `-O3` | |---|---|---|---| | fps, median of 160 samples | 91.8 | **95.8** | **95.8** | | per-run medians | 88.9, 91.8, 91.8, 92.9 | 92.8, 95.8, 95.8, 95.8 | 95.8, 95.8, 95.8, 95.8 | The all-`O2` build is 4.4% faster than main's default; `-O3` is within noise of it (0.0%). The first runs of the session were slower (the GPU's clocks ramp): the interleaved later runs are main 92.9, `-O2` 95.8, `-O3` 95.8. The runs had occasional hitches (12.8-45.4 fps in one sample), which the median ignores. ### Flags and settings Three build switches, all compile-only and off by default: | Flag | What it is | Before this PR | After this PR | Effect | Recommendation | |---|---|---|---|---|---| | `LONGSHOT_CHUNK_OPT=all` or `<file>` | The lifted chunks at the level below (all, or the ones a file names) | absent | as the opt-budget report proposed | the game's lifted code at `-O2`/`-O3` | opt-in: an experiment or a quality build | | `LONGSHOT_CHUNK_LEVEL=<level>` | The level its chunks compile at (`O1`, `O2` or `O3`; default `O2`) | absent | `O2` | `-O3` gives no fps over `-O2` here | `O2`; `O3` only for a scene A/B | | `LONGSHOT_CHUNK_PART_MB=<MB>` | The parts a chunk sent to the level above is cut into (default 6; `0`: whole chunks) | absent | 6 | the cut above | keep 6 | ## Testing **Tested:** `python3 -I -B tests/run_all.py --jobs 8`: 609 passed, 36 failed, 77 skipped; the same failures (and 2 more) fail on clean `origin/main` @ 544229a2 here (606 passed, 38 failed), so no new failure. `tests/test_chunk_parts.py` passes. In the game (Linux, RADV, RX 9070 XT), Link's house from the repository save `kokiri-start`, standing still: 91.8 fps on main's default (hot list at `-O2`), 95.8 on this branch at `-O2` and 95.8 at `-O3` (four interleaved runs each, the median of 160 samples); no crash or assertion. The three `docs/tested/` files have the runs. **Not tested:** Windows. **Must be tested:** none. ## Risks **What could break:** the parts compile to the same functions but the inliner sees one part at a time, so the code layout differs slightly (the exe is 23.5 MB smaller at `-O2`, 11.3 MB larger at `-O3` than main's default). The hot pieces are not cut, so the game's hot path is unchanged. A chunk whose text the cut refuses stays whole. **Turning it off:** `LONGSHOT_CHUNK_PART_MB=0` (or unset `LONGSHOT_CHUNK_OPT`). **Compatibility:** nothing for players: `LONGSHOT_CHUNK_OPT` is opt-in, and a release build sets neither switch. ## Checklist ### Everyone - [x] One topic. - [x] The title is a Conventional Commit (`type(scope): description`) of the status line's type. - [x] Why gives the reason plainly and links the issues that fit (none). - [x] Tested on my own PC where it runs (in the game, for a change the game runs), as Testing's Tested says; what can't be run by hand is in Testing's Not testable by hand, with why. - [x] Measurements has a verdict and the table. - [x] Nothing gets worse that I know of: any cost (speed, latency, memory, a setup that worked before) is measured and in Risks. - [x] Testing names what was tested, what wasn't, and what must still be tested. - [x] Rebased on current `main` (67efc4d3). - [x] `python -I -B tests/run_all.py` passes (the failures are pre-existing; named above). - [x] No game files, dumps, build output or generated files. - [x] `third_party/` untouched (a new folder with a `PROVENANCE.md` instead). - [x] The license is OK: GPL-3.0-or-later, nothing incompatible and nothing decompiled. ### When it applies - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. - [x] Numbers from the same PC, scene and settings, at least 2 interleaved runs each, the median reported. (From-scratch builds cannot be interleaved cheaply: one build each of 2:57, 5:00 and 5:00; the effect is far outside the run-to-run spread. The fps runs are four interleaved runs each.) - [x] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A game-free test added for the fix, failing on `main` and passing here. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated.
perf(build): the chunks an all-O2 build compiles are cut into parts
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
b396651895
LONGSHOT_CHUNK_OPT=all compiles every lifted chunk at -O2. At -O2 a 25 MB chunk's
passes cost more than linearly in its functions' sizes (GVN alone was 43-46% of the
compile), and 32 of them at once contend for memory bandwidth: from scratch on one
lift, the build took 23:06 (compile 1,384 s, 31,675 s of lifted compiles, longest
960 s).

The build now cuts each chunk it sends to -O2 at function starts into parts of about
LONGSHOT_CHUNK_PART_MB (6) MB of estimated compile cost, each with the chunk's
declarations and each its own object (chunk_parts, the lift's own chunks._cut). The
lifted C is not changed. The same build: 4:37 (compile 268 s, 7,859 s of lifted
compiles, longest 91 s). The parts are written to <build>/split with a stamp, so a
build that changed nothing writes nothing; a chunk's edit compiles the parts that
changed. --kept-lift builds are not cut.

The exe is 0.13% smaller (the inliner sees one part at a time; the hot pieces are not
cut). A headless run of the parts build presented 6,885 frames in 30 s with no crash.

tests/test_chunk_parts.py: the cut, the functions and declarations, the stamp, the
selection and the -O2 flags, game-free.
Author
Contributor

Tested in game: Linux, RADV, RX 9070 XT: the parts build ran headless at the title, 6,885 frames in 30 s, no crash or assertion

Tested in game: Linux, RADV, RX 9070 XT: the parts build ran headless at the title, 6,885 frames in 30 s, no crash or assertion
Marcuss2 force-pushed perf/build-o2-chunks from b396651895
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 7s
Website / Website on Cloudflare (pull_request_target) Has been skipped
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to db06875203
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-17 16:11:49 +00:00
Compare
Marcuss2 force-pushed perf/build-o2-chunks from db06875203
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 4s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
to c3cfa11a46
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 8s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
2026-11-17 16:12:30 +00:00
Compare
Marcuss2 changed title from WIP: perf(build): the chunks an all-O2 build compiles are cut into parts to perf(build): the chunks an all-O2 build compiles are cut into parts 2026-11-17 16:12:44 +00:00
perf(build): the chunks' level is a switch (LONGSHOT_CHUNK_LEVEL)
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 5s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
c2f3e5b5fb
The all-O2 build's cut applies to any level: LONGSHOT_CHUNK_LEVEL (O1, O2 or O3; default O2) is the level
LONGSHOT_CHUNK_OPT's chunks compile at. The level is in the object key through the flags, so a -O3 object is never
taken for a -O2 one. Measured for the three-way build comparison: main at -O1, this branch at -O2 and at -O3.

Assisted-by: DeepSeek Harness
Author
Contributor

Added LONGSHOT_CHUNK_LEVEL and the three-way comparison on 67efc4d3: main -O1 2:34, this branch -O2 4:29, -O3 4:34; -O3 is 5 s more than -O2 for +8 MB of exe. Both -O2 and -O3 ran headless at the title, 6,885/6,890 frames in 30 s, no crash.

Added LONGSHOT_CHUNK_LEVEL and the three-way comparison on 67efc4d3: main -O1 2:34, this branch -O2 4:29, -O3 4:34; -O3 is 5 s more than -O2 for +8 MB of exe. Both -O2 and -O3 ran headless at the title, 6,885/6,890 frames in 30 s, no crash.
Owner

Thanks this is great work, we'll look into this!

Thanks this is great work, we'll look into this!
HumanBean added this to the WIP project 2026-11-17 17:20:16 +00:00
HumanBean added this to the v3.1.0 milestone 2026-11-17 17:20:42 +00:00
docs(tested): the three-way fps of the all-O2 chunks at Link's house
Some checks failed
PR description / Description follows the template (pull_request_target) Successful in 3s
CI / Conventional Commit title (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been cancelled
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been cancelled
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been cancelled
CI / Workflow lint (actionlint) (pull_request) Has been cancelled
Guide screenshots / Guide images and local UI source review (pull_request) Has been cancelled
Third-party parts / As their notes say (pull_request) Has been cancelled
Third-party parts / The same as upstream (pull_request) Has been cancelled
Website / Website on Cloudflare (pull_request) Has been cancelled
4ab8eafb3e
main @ 67efc4d3 at -O1, this branch at -O2 and at -O3, two interleaved runs each: 86.9, 91.9 and 92.8 fps (the median of
80 samples a build). Link's house from the repository save kokiri-start, standing still, 20 s warm-up then the control
bridge's fps once a second for 40 s; 2560x1440, the game's own upscaler, HOS_DYNRES=0, HOS_FPS_MAX=1000, headless.

Assisted-by: DeepSeek Harness
Author
Contributor

FPS benchmark of the three builds at Link house (repo save kokiri-start), two interleaved runs each, median of 80 samples: main 86.9, this branch -O2 91.9, -O3 92.8 fps. -O2 is +5.8% over main, -O3 +1.0% over -O2. Three docs/tested files added (commit 4ab8eafb).

FPS benchmark of the three builds at Link house (repo save kokiri-start), two interleaved runs each, median of 80 samples: main 86.9, this branch -O2 91.9, -O3 92.8 fps. -O2 is +5.8% over main, -O3 +1.0% over -O2. Three docs/tested files added (commit 4ab8eafb).
docs(tested): the hot-list three-way fps at Link's house
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 10s
ef82c5a545
main's default is not all -O1: the hot list's functions are compiled at -O2. With the 47-function list from the
opt-budget report (the shipped profile is not in this checkout), main @ 67efc4d3 is 91.8 fps, this branch at -O2 is
95.8 and at -O3 95.8 (four interleaved runs each, the median of 160 samples). The all-O2 build is +4.4% over main's
default; -O3 is within noise.

Assisted-by: DeepSeek Harness
Author
Contributor

Correction: main default is not all -O1. Rebuilt all three on a lift with the hot list (47 functions, the opt-budget list; the shipped profile is not in this checkout): main default 2:57 build / 91.8 fps, this branch -O2 5:00 / 95.8 fps, -O3 5:00 / 95.8 fps (four interleaved runs each). So the all-O2 build is +4.4% fps over main default for +2:03 of build; -O3 is within noise. The docs/tested files are updated (commit ef82c5a5).

Correction: main default is not all -O1. Rebuilt all three on a lift with the hot list (47 functions, the opt-budget list; the shipped profile is not in this checkout): main default 2:57 build / 91.8 fps, this branch -O2 5:00 / 95.8 fps, -O3 5:00 / 95.8 fps (four interleaved runs each). So the all-O2 build is +4.4% fps over main default for +2:03 of build; -O3 is within noise. The docs/tested files are updated (commit ef82c5a5).
Owner

Brought up to the ready-for-review standard (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know).

  • Tested on my own PC: ticked: Testing's Tested: the author's own in-game fps runs on Linux, RADV RX 9070 XT.
  • Nothing gets worse that I know of: ticked: Measurements gives build time and fps numbers, and the exe size change is measured.
Brought up to the [ready-for-review standard](https://git.magicbean.dev/MagicBeanDev/Longshot/src/branch/main/CONTRIBUTING.md#ready-for-review-out-of-wip) (#1454): the checklist's Everyone list has two new boxes, added here from what this PR's description and comments show (please check they match what you know). - *Tested on my own PC*: ticked: Testing's Tested: the author's own in-game fps runs on Linux, RADV RX 9070 XT. - *Nothing gets worse that I know of*: ticked: Measurements gives build time and fps numbers, and the exe size change is measured.
HumanBean deleted branch perf/build-o2-chunks 2026-11-17 21:51:37 +00:00
Some checks are pending
CI / Conventional Commit title (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Blocked by required conditions
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Blocked by required conditions
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Blocked by required conditions
CI / Workflow lint (actionlint) (pull_request) Blocked by required conditions
Guide screenshots / Guide images and local UI source review (pull_request) Blocked by required conditions
Third-party parts / As their notes say (pull_request) Blocked by required conditions
Third-party parts / The same as upstream (pull_request) Blocked by required conditions
Website / Website on Cloudflare (pull_request) Blocked by required conditions
PR description / Description follows the template (pull_request_target) Successful in 10s
Some workflows are waiting to be reviewed.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
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!1431
No description provided.