Add live switches for A/B comparisons in one session #10

Closed
github-bot wants to merge 1 commit from gh-pr/10/head into gh-pr/10/base
Owner

@⁠TaynanGT on GitHub · 2026-11-25 18:58 UTC · original
TaynanGT:claude/live-switches → local/fxceless-render · +263 −5 · 5 files · 1 commits · closed without merging

What and why

Comparing two settings by starting the game twice costs about three minutes per run just to load the same scene again, and each run lands on a different moment of it, so the difference between two runs is often smaller than the spread between runs of the same build. Live switches change while the title runs: the scene is loaded once and the two settings take turns in it.

Full write-up: docs/live-switches.md.

How it works

  • crates/victory-gpu/src/live.rs: Live::new(NAME, default) reads its environment variable the first time it is checked. With VICTORY_LIVE=<file>, a thread reads that file four times a second; NAME=VALUE lines override the variable (0 off, anything else on), and a name left out goes back to it. A check is one atomic load. Each change, and each value the file names anew, is logged as live switch NAME=VALUE.
  • VICTORY_HEAP_SYNC and VICTORY_WIDE_REFRESH are live. Only switches whose code reads them each time, with no state a change in the middle would leave inconsistent, are made live. A heap made while the sync is off is not tracked.
  • VICTORY_METER_MS sets how often the frame line is logged. It already held only the last second's numbers; the default stays 5 s, and 1000 logs every second's.
  • Without VICTORY_LIVE nothing changes: no thread starts, and the switches keep their environment values.

Results

VICTORY_HEAP_SYNC in one session on 77c3019 with this branch, first room, three cycles of 20 s each way, 49 one-second samples per state, the first 3 s after each change left out:

State FPS ms/frame
on (default) 6.7 148.5
off 8.2 121.8

Per cycle, FPS on/off: 6.2/8.5, 7.1/6.8, 6.9/8.2. The comparison took about five minutes in all.

Tests

  • New live::tests: lines_set_switches_on_and_off and the_file_overrides_the_environment_and_leaving_a_name_out_goes_back.
  • cargo test --workspace --release --locked: all passed (victory-gpu 255, victory-shader 296, the rest of the workspace, the asset policy).
  • cargo clippy --workspace --all-targets --locked -- -D warnings, and with --all-features: clean.

🤖 Generated with Claude Code

**@⁠TaynanGT** on GitHub · 2026-11-25 18:58 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/10) `TaynanGT:claude/live-switches` → `local/fxceless-render` · +263 −5 · 5 files · 1 commits · closed without merging ## What and why Comparing two settings by starting the game twice costs about three minutes per run just to load the same scene again, and each run lands on a different moment of it, so the difference between two runs is often smaller than the spread between runs of the same build. Live switches change while the title runs: the scene is loaded once and the two settings take turns in it. Full write-up: [`docs/live-switches.md`](../blob/claude/live-switches/docs/live-switches.md). ## How it works - `crates/victory-gpu/src/live.rs`: `Live::new(NAME, default)` reads its environment variable the first time it is checked. With `VICTORY_LIVE=<file>`, a thread reads that file four times a second; `NAME=VALUE` lines override the variable (`0` off, anything else on), and a name left out goes back to it. A check is one atomic load. Each change, and each value the file names anew, is logged as `live switch NAME=VALUE`. - `VICTORY_HEAP_SYNC` and `VICTORY_WIDE_REFRESH` are live. Only switches whose code reads them each time, with no state a change in the middle would leave inconsistent, are made live. A heap made while the sync is off is not tracked. - `VICTORY_METER_MS` sets how often the frame line is logged. It already held only the last second's numbers; the default stays 5 s, and 1000 logs every second's. - Without `VICTORY_LIVE` nothing changes: no thread starts, and the switches keep their environment values. ## Results `VICTORY_HEAP_SYNC` in one session on `77c3019` with this branch, first room, three cycles of 20 s each way, 49 one-second samples per state, the first 3 s after each change left out: | State | FPS | ms/frame | |---|---|---| | on (default) | 6.7 | 148.5 | | off | 8.2 | 121.8 | Per cycle, FPS on/off: 6.2/8.5, 7.1/6.8, 6.9/8.2. The comparison took about five minutes in all. ## Tests - New `live::tests`: `lines_set_switches_on_and_off` and `the_file_overrides_the_environment_and_leaving_a_name_out_goes_back`. - `cargo test --workspace --release --locked`: all passed (victory-gpu 255, victory-shader 296, the rest of the workspace, the asset policy). - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and with `--all-features`: clean. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Comparing two settings by starting the game twice costs about three
minutes per run to load the same scene, and lands on a different moment
of it. Live switches change while the title runs.

- live.rs: a Live switch reads its environment variable once; with
  VICTORY_LIVE=<file> a thread reads NAME=VALUE lines from that file four
  times a second and overrides it. A check is one atomic load; each
  change is logged as "live switch NAME=VALUE".
- VICTORY_HEAP_SYNC and VICTORY_WIDE_REFRESH are live.
- VICTORY_METER_MS sets how often the frame line is logged (5 s by
  default); 1000 logs every second's numbers.
- docs/live-switches.md: use, method, which switches are live, results.

In one session on the first room, VICTORY_HEAP_SYNC on against off over
three 20-second cycles: 6.7 FPS (148.5 ms) against 8.2 FPS (121.8 ms),
49 one-second samples per state.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:57:48 +00:00
github-bot closed this pull request 2026-11-26 05:57:48 +00:00
Author
Owner

@⁠TaynanGT on GitHub · 2026-11-25 19:21 UTC · original · edited 2026-11-25 20:01 UTC

Moved into #11, which holds all of this work on one branch, since merged into main.

**@⁠TaynanGT** on GitHub · 2026-11-25 19:21 UTC · [original](https://github.com/TaynanGT/Vice-Tay/pull/10#issuecomment-7172181952) · edited 2026-11-25 20:01 UTC Moved into #11, which holds all of this work on one branch, since merged into `main`.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.