perf(builder): a dump folder's stamp takes its files' sizes and times from the folder listing, not a stat of each file #2969

Merged
HumanBean merged 1 commit from HumanBean/Longshot:perf/dump-stamp-listing into main 2026-12-01 19:47:34 +00:00
Owner

Summary

On a PC whose game is a dump folder (extracted romfs/ and exefs/), the launcher can fail Play after a restart with "Longshot's builder did not answer within 10 seconds" (LongshotLauncher#373 and the thread after it). info and Play's fast check stamp such a game by the size and time of every file under romfs/, and each file was opened by its path for them. On Windows, after a restart, that took 10 to 15 s for tens of thousands of files, and an antivirus program sees every open. This takes the sizes and times from each folder's listing, which already carries them, so no file is opened. The stamp is the same text as before, so no game is built again because of it.

Read first: files_under_with_metadata in builder/crates/build-core/src/fsx.rs and game_stamp in builder/crates/build-driver/src/play.rs. See LongshotLauncher#373, #390.

Testing

Tested: Linux only, game-free, on the two crates: cargo test -p build-core fsx and cargo test -p build-driver --lib play:: pass, and cargo clippy --locked -p build-core -p build-driver --all-targets -- -D warnings is clean. A new test checks that a dump's stamp equals the one made by opening each file, and another that the listing's metadata equals fs::metadata for each file (a link followed). Not run in the game, and not run on Windows. Opened with --force at the request of the person I work for.

Still to test:

  • Windows, a game that is a dump folder, after a restart: time longshot-builder info before and after, expecting the first call to drop from 10 to 15 s to about a second (by hand: the player in LongshotLauncher#373, Measure-Command { .\Longshot.exe info --output json | Out-Null })
  • Any PC: play a built game from a dump folder, expecting no new build (by hand)

Measurements

Verdict: not measured. I have no dump-folder game and no Windows PC here; the cause is the likely one, not a confirmed one.

Setup: none run.

Before: main @ 495ed9fe After: this PR @ 5440f8fe
info of a dump folder, cold, Windows not measured not measured

Risks

The stamp text is unchanged, so no game is built again and nothing changes for a player. A revert is enough. A link inside romfs/ is still followed, as before (a dump with links is refused elsewhere).

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. (Not run in the game.)
  • mise run test passes. (Only the two crates' tests and Clippy ran; not the workspace.)
  • Measured against main, or Measurements says why there is nothing to measure. (Not measured.)
  • No game files, build output or hand-edited generated files; third_party/ untouched; nothing GPL-incompatible.

When it applies

  • A fix: a game-free test that fails on main and passes here. (The tests pass on main too: they keep the stamp the same; the speed-up has no game-free test.)
  • AI assistance recorded with Assisted-by: / Co-Authored-By: trailers.

🤖 Generated with Claude Code

## Summary On a PC whose game is a dump folder (extracted `romfs/` and `exefs/`), the launcher can fail Play after a restart with "Longshot's builder did not answer within 10 seconds" (LongshotLauncher#373 and the thread after it). `info` and Play's fast check stamp such a game by the size and time of every file under `romfs/`, and each file was opened by its path for them. On Windows, after a restart, that took 10 to 15 s for tens of thousands of files, and an antivirus program sees every open. This takes the sizes and times from each folder's listing, which already carries them, so no file is opened. The stamp is the same text as before, so no game is built again because of it. Read first: `files_under_with_metadata` in `builder/crates/build-core/src/fsx.rs` and `game_stamp` in `builder/crates/build-driver/src/play.rs`. See LongshotLauncher#373, #390. ## Testing **Tested:** Linux only, game-free, on the two crates: `cargo test -p build-core fsx` and `cargo test -p build-driver --lib play::` pass, and `cargo clippy --locked -p build-core -p build-driver --all-targets -- -D warnings` is clean. A new test checks that a dump's stamp equals the one made by opening each file, and another that the listing's metadata equals `fs::metadata` for each file (a link followed). **Not run in the game, and not run on Windows.** Opened with `--force` at the request of the person I work for. **Still to test:** - Windows, a game that is a dump folder, after a restart: time `longshot-builder info` before and after, expecting the first call to drop from 10 to 15 s to about a second (by hand: the player in LongshotLauncher#373, `Measure-Command { .\Longshot.exe info --output json | Out-Null }`) - Any PC: play a built game from a dump folder, expecting no new build (by hand) ## Measurements **Verdict:** not measured. I have no dump-folder game and no Windows PC here; the cause is the likely one, not a confirmed one. Setup: none run. | | Before: main @ 495ed9fe | After: this PR @ 5440f8fe | |---|---|---| | `info` of a dump folder, cold, Windows | not measured | not measured | ## Risks The stamp text is unchanged, so no game is built again and nothing changes for a player. A revert is enough. A link inside `romfs/` is still followed, as before (a dump with links is refused elsewhere). ## Checklist ### Ready for review - [x] 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. (Not run in the game.) - [ ] `mise run test` passes. (Only the two crates' tests and Clippy ran; not the workspace.) - [ ] Measured against `main`, or Measurements says why there is nothing to measure. (Not measured.) - [x] No game files, build output or hand-edited generated files; `third_party/` untouched; nothing GPL-incompatible. ### When it applies - [ ] A fix: a game-free test that fails on `main` and passes here. (The tests pass on `main` too: they keep the stamp the same; the speed-up has no game-free test.) - [x] AI assistance recorded with `Assisted-by:` / `Co-Authored-By:` trailers. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
perf(builder): a dump folder's stamp takes its files' sizes and times from the folder listing, not a stat of each file
Some checks failed
CI / What the change needs (pull_request) Successful in 8s
CI / Third-party parts and guide screenshots (pull_request) Failing after 12s
CI / Lint (pre-commit, ShellCheck, actionlint) (pull_request) Successful in 11s
CI / Rust (rustfmt, clippy, cargo test, end to end) (pull_request) Successful in 3m13s
CI / Host C for Windows (llvm-mingw, compile only) (pull_request) Successful in 1m38s
CI / Renderer build check (Windows, compile --only renderer, without and with FSR 4) (pull_request) Successful in 6m43s
CI / Renderer build check (Linux, compile --only renderer, without and with FSR 4) (pull_request) Successful in 6m52s
PR description / Title and description (pull_request_target) Failing after 7s
CI / Website build and checks (pull_request) Failing after 30s
CI / Game-free checks (run_all.py, part 1/2) (pull_request) Failing after 28m47s
CI / Game-free checks (run_all.py, part 2/2) (pull_request) Failing after 37m41s
5440f8fe78
`info` and play's fast check stamp a game that is a dump folder by the size and time of every file under romfs/. Each file was
opened by its path for them: on a Windows PC that had not read the tree lately that took 10 to 15 s for the launcher's
first `info` after a restart ("Longshot's builder did not answer within 10 seconds"). The listing already carries both.
The stamp is the same text, so no build is made again for it.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
HumanBean changed title from WIP: perf(builder): a dump folder's stamp takes its files' sizes and times from the folder listing, not a stat of each file to perf(builder): a dump folder's stamp takes its files' sizes and times from the folder listing, not a stat of each file 2026-12-01 19:47:27 +00:00
HumanBean deleted branch perf/dump-stamp-listing 2026-12-01 19:47:34 +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!2969
No description provided.