WIP: perf(build): the Builder runs the build at normal priority, not below it #779

Draft
dyst wants to merge 1 commit from dyst/Longshot:perf/build-priority into main
Member

Type: perf · Risk: low · Tested on: Windows 11 (game-free checks) · Needs: Windows on a hybrid Intel CPU (12th gen or later), a first build

Why

On an Intel CPU with efficiency cores, the first build can take over an hour longer than it should. The Builder starts make_game.py below normal priority, and Windows keeps a below-normal process's single-threaded steps (reading the game, the lift) on the efficiency cores while the performance cores sit idle. Project ReLink, a fork of Longshot, found and fixed this (commits 0a74889c and b98adb9e).

What changed

The Builder now runs the build at normal priority. LONGSHOT_LOW_PRIORITY=1 brings back below normal, for a desktop that stays quicker during the build.

  • builder: Runner.Start in builder/LongshotBuilder/Runner.cs sets ProcessPriorityClass.BelowNormal on make_game.py only when LONGSHOT_LOW_PRIORITY=1.
  • docs: the switch's row in docs/development.md.
  • tests: tests/test_builder_own_python.py checks that below normal is only set when the switch asks.

Measurements

Not measured here: this PC isn't a hybrid Intel CPU. ReLink's report was over an hour of a first build on the efficiency cores. The numbers to take are a first build's time with and without LONGSHOT_LOW_PRIORITY=1 on such a CPU.

Flags and settings

One new build switch.

Flag What it is Before this PR After this PR Effect Helps / doesn't help / untested Recommendation
LONGSHOT_LOW_PRIORITY The Builder's build below normal priority always below normal unset: normal; 1: below normal Normal priority lets Windows run the build's one-process steps on the performance cores Untested here; helped ReLink's hybrid-CPU players Unset for everyone; 1 only to keep the desktop quicker during a build

Testing

Tested:

  • python -I -B tests/test_builder_own_python.py (with the new check), and tests/run_all.py builder docs: 6 passed, 1 skipped (no clang here).
  • dotnet build builder/LongshotBuilder -c Release: 0 warnings.

Not tested:

  • A build in the Builder at the new priority.

Must be tested:

  • Windows, a hybrid Intel CPU (12th gen or later): run a first build with the Builder from this branch, then one with LONGSHOT_LOW_PRIORITY=1. Expect the first to be shorter, with the read and the lift on the performance cores in Task Manager (by hand).

Risks

What could break: the desktop can feel slower during a build, since the compilers now run at normal priority.

Turning it off: LONGSHOT_LOW_PRIORITY=1, or revert the commit.

Compatibility: nothing changes for a player beyond the build's priority.

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 (the tracker searched).
  • Measurements has a verdict, or one line saying why there is nothing to measure.
  • Testing names what was tested, what wasn't, and what must still be tested, where and how.
  • Rebased on current main.
  • python -I -B tests/run_all.py passes (any failure that also fails on main is named). (Not yet: only the checks this touches were run; the full run is left to the testing pass.)
  • 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.
  • Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value.
  • A check under tests/ that reads changed source updated in this PR, not weakened.
  • Docs updated.

🤖 Generated with Claude Code

**Type:** perf · **Risk:** low · **Tested on:** Windows 11 (game-free checks) · **Needs:** Windows on a hybrid Intel CPU (12th gen or later), a first build ## Why On an Intel CPU with efficiency cores, the first build can take over an hour longer than it should. The Builder starts `make_game.py` below normal priority, and Windows keeps a below-normal process's single-threaded steps (reading the game, the lift) on the efficiency cores while the performance cores sit idle. Project ReLink, a fork of Longshot, found and fixed this (commits [0a74889c](https://github.com/pixl27/ProjectReLink/commit/0a74889c) and [b98adb9e](https://github.com/pixl27/ProjectReLink/commit/b98adb9e)). ## What changed The Builder now runs the build at normal priority. `LONGSHOT_LOW_PRIORITY=1` brings back below normal, for a desktop that stays quicker during the build. - builder: `Runner.Start` in `builder/LongshotBuilder/Runner.cs` sets `ProcessPriorityClass.BelowNormal` on `make_game.py` only when `LONGSHOT_LOW_PRIORITY=1`. - docs: the switch's row in `docs/development.md`. - tests: `tests/test_builder_own_python.py` checks that below normal is only set when the switch asks. ## Measurements Not measured here: this PC isn't a hybrid Intel CPU. ReLink's report was over an hour of a first build on the efficiency cores. The numbers to take are a first build's time with and without `LONGSHOT_LOW_PRIORITY=1` on such a CPU. ### Flags and settings One new build switch. | Flag | What it is | Before this PR | After this PR | Effect | Helps / doesn't help / untested | Recommendation | |---|---|---|---|---|---|---| | `LONGSHOT_LOW_PRIORITY` | The Builder's build below normal priority | always below normal | unset: normal; `1`: below normal | Normal priority lets Windows run the build's one-process steps on the performance cores | Untested here; helped ReLink's hybrid-CPU players | Unset for everyone; `1` only to keep the desktop quicker during a build | ## Testing **Tested:** - `python -I -B tests/test_builder_own_python.py` (with the new check), and `tests/run_all.py builder docs`: 6 passed, 1 skipped (no clang here). - `dotnet build builder/LongshotBuilder -c Release`: 0 warnings. **Not tested:** - A build in the Builder at the new priority. **Must be tested:** - **Windows, a hybrid Intel CPU (12th gen or later):** run a first build with the Builder from this branch, then one with `LONGSHOT_LOW_PRIORITY=1`. Expect the first to be shorter, with the read and the lift on the performance cores in Task Manager (by hand). ## Risks **What could break:** the desktop can feel slower during a build, since the compilers now run at normal priority. **Turning it off:** `LONGSHOT_LOW_PRIORITY=1`, or revert the commit. **Compatibility:** nothing changes for a player beyond the build's priority. ## 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 (the tracker searched). - [x] Measurements has a verdict, or one line saying why there is nothing to measure. - [x] Testing names what was tested, what wasn't, and what must still be tested, where and how. - [x] Rebased on current `main`. - [ ] `python -I -B tests/run_all.py` passes (any failure that also fails on `main` is named). (Not yet: only the checks this touches were run; the full run is left to the testing pass.) - [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] Switches documented (docs/development.md; the README for a menu row) and shipped at their recommended value. - [x] A check under `tests/` that reads changed source updated in this PR, not weakened. - [x] Docs updated. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
perf(build): the Builder runs the build at normal priority, not below it
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
CI / Workflow lint (actionlint) (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 5s
Third-party parts / As their notes say (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
f2c3af12dd
The Builder started make_game.py below normal priority, and the read of the game, the lift and every
compiler inherited it. On a hybrid Intel CPU Windows kept the one-process steps on the efficiency cores,
and the first build lost an hour and more with the performance cores idle (Project ReLink found it,
0a74889c and b98adb9e). Normal priority now; LONGSHOT_LOW_PRIORITY=1 keeps the old one for a desktop that
stays quicker while the game builds.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Some checks failed
CI / Python source checks (ubuntu-24.04, part 1/2) (pull_request) Has been skipped
CI / Python source checks (ubuntu-24.04, part 2/2) (pull_request) Has been skipped
CI / SPIR-V fixtures (global narrow load/store, direct surface atomics, F2I immediate) (pull_request) Has been skipped
Third-party parts / The same as upstream (pull_request) Has been skipped
CI / Conventional Commit title (pull_request) Successful in 4s
CI / Workflow lint (actionlint) (pull_request) Successful in 5s
Guide screenshots / Guide images and local UI source review (pull_request) Failing after 5s
Third-party parts / As their notes say (pull_request) Successful in 7s
PR description / Description follows the template (pull_request_target) Successful in 3s
Website / Website on Cloudflare (pull_request_target) Has been skipped
This pull request is marked as a work in progress.
This branch is out-of-date with the base branch
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'perf/build-priority:dyst-perf/build-priority'
git switch 'dyst-perf/build-priority'
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!779
No description provided.