[pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds #152

Open
Jesper-A wants to merge 5 commits from Jesper-A/Darner:up-ab-howto into main
Contributor

Contributor role (optional)

  • Fluxer ID:

What it changes

Docs only. No code, no switch, no default changes.

  • New page docs/ab-testing.md, "How to A/B a change" (140 lines), linked from the README's docs list. It explains how to say "this setting is faster or slower by N fps" so that someone else can repeat it. It uses only what Darner already has: DARNER_BENCH_CSV, DARNER_INPUT_RECORD / DARNER_INPUT_REPLAY, DARNER_KEYS / DARNER_KEYS_FROM, DARNER_EXIT_AFTER_WORLD_S, DARNER_HOT_AB, DARNER_AB, scripts/bench.ps1, the 5 s fps log line and the 1 s frame times: log line. The method it states:
    • run the arms A B B A (A B C C B A for three or more), so steady drift hits both arms alike;
    • a warm-up run first, not counted; restart between arms; change one thing at a time;
    • the noise floor is the spread between runs of the same arm; a difference inside it is "no change we could measure", not a win or a loss;
    • standing still (low noise, hides texture lag) against a recorded or keyed route (more noise, shows texture lag);
    • decide the window and the number of runs before looking at the numbers;
    • what to put in an issue or pull request, and a list of common traps.
  • README, DARNER_BENCH_CSV row corrected. It said the file holds four columns (frame number, time, frame time, draw count). crates/darner-gpu/src/bench.rs writes about 100 columns, one row per rendered frame (the module doc there says "The earlier file had four columns ... this one ... adds the rest"). The row now says that and points to the column list at the top of bench.rs.

The method is the one used in an A/B report already posted here as an example of it in use: #76 (comment) (arms in the order A1, B1, B2, A2, one unscored warm-up run per arm, noise read from the two runs of each arm). The page itself contains no new measurements.

Note for the maintainer (not changed here). The README's DARNER_INPUT_RECORD row says it "records controller and keyboard input". The code records the pads' readings only (crates/darner-hle/src/modules/gameinput.rs, doc comment on DARNER_INPUT_RECORD: "The pads' readings written to a file"). The new page says "use a controller" for that reason. I left the README row alone to keep this PR to one change; say if you want it fixed here or in a follow-up. Keyboard routes go through DARNER_KEYS.

How it was tested

  • Tested revision: branch up-ab-howto at 054f0b1e0 (three commits on main 57dea7f23).
  • Commands and results:
    • cargo xtask policy on 054f0b1e0: passed (554 files ok).
    • Not run: cargo clippy --workspace --all-targets --locked -- -D warnings, the same with --all-features, cargo test --workspace --locked. The diff is two Markdown files and touches no code. There is no CI upstream, so none of this was checked by CI.
  • Gameplay, when relevant: not run in game. Nothing in the page is a new measurement.
  • Before and after, when relevant: not applicable.
  • Shader wave sizes tested, when relevant: not applicable.
  • Coverage gaps:
    • The log line formats and switch names were read in the source on main 57dea7f23 (host.rs frame_times_line and the 5 s fps line, hot.rs, README.md switch rows). I did not start the game to see them in a log.
    • Nobody else has followed the guide yet, so I do not know where a newcomer gets stuck. That is why this is a draft.
    • scripts/bench.ps1 needs the diagnostics build; the page says so, but I did not run it for this change.

Checklist

  • This PR contains one change based on main.
  • The diff follows docs/asset-policy.md.
  • I recorded this PR's dependencies below.
    • Depends on: none

Spec dependence

  • Likely general (helps any card): all of it. The method and the log lines do not depend on the GPU; the README row describes what bench.rs writes.
  • May depend on our specs: nothing. The page's example numbers (3 to 5 minutes per run, the last 180 s counted, about 10 % in draws per frame) are starting points, not measurements, and the page says to decide the window beforehand.
  • Untested elsewhere: not run on any machine. The DARNER_HOT_AB and DARNER_AB paragraphs say to use them only for a setting known to follow them, and to check the log.

Checked for overlap

  • I searched the open pull requests for the same issue and for the files this touches.
  • Related PRs: none cover the same thing (no open PR adds an A/B or benchmark guide or edits the DARNER_BENCH_CSV row). Open PRs that also edit README.md (#147, #146, #145, #142, #140, #118, #110, #75, #59, #37, #36, #34, and our own #18 to #9) touch other rows. A trial merge of this branch with each head ended with no README conflict, except that #16, #12 and #9 already conflict with main on their own, with or without this branch. Searches for "benchmark", "A/B" and "bench" found issues and PRs that use A/B runs (#145, #76, #2) but none that explain the method.

Drafted with AI assistance (Claude Code).

## Contributor role (optional) - Fluxer ID: ## What it changes Docs only. No code, no switch, no default changes. - **New page `docs/ab-testing.md`, "How to A/B a change"** (140 lines), linked from the README's docs list. It explains how to say "this setting is faster or slower by N fps" so that someone else can repeat it. It uses only what Darner already has: `DARNER_BENCH_CSV`, `DARNER_INPUT_RECORD` / `DARNER_INPUT_REPLAY`, `DARNER_KEYS` / `DARNER_KEYS_FROM`, `DARNER_EXIT_AFTER_WORLD_S`, `DARNER_HOT_AB`, `DARNER_AB`, `scripts/bench.ps1`, the 5 s `fps` log line and the 1 s `frame times:` log line. The method it states: - run the arms A B B A (A B C C B A for three or more), so steady drift hits both arms alike; - a warm-up run first, not counted; restart between arms; change one thing at a time; - the noise floor is the spread between runs of the same arm; a difference inside it is "no change we could measure", not a win or a loss; - standing still (low noise, hides texture lag) against a recorded or keyed route (more noise, shows texture lag); - decide the window and the number of runs before looking at the numbers; - what to put in an issue or pull request, and a list of common traps. - **README, `DARNER_BENCH_CSV` row corrected.** It said the file holds four columns (frame number, time, frame time, draw count). `crates/darner-gpu/src/bench.rs` writes about 100 columns, one row per rendered frame (the module doc there says "The earlier file had four columns ... this one ... adds the rest"). The row now says that and points to the column list at the top of `bench.rs`. The method is the one used in an A/B report already posted here as an example of it in use: https://git.gtahub.st/TrustNo1/Darner/pulls/76#issuecomment-851602 (arms in the order A1, B1, B2, A2, one unscored warm-up run per arm, noise read from the two runs of each arm). The page itself contains no new measurements. **Note for the maintainer (not changed here).** The README's `DARNER_INPUT_RECORD` row says it "records controller and keyboard input". The code records the pads' readings only (`crates/darner-hle/src/modules/gameinput.rs`, doc comment on `DARNER_INPUT_RECORD`: "The pads' readings written to a file"). The new page says "use a controller" for that reason. I left the README row alone to keep this PR to one change; say if you want it fixed here or in a follow-up. Keyboard routes go through `DARNER_KEYS`. ## How it was tested - Tested revision: branch `up-ab-howto` at 054f0b1e0 (three commits on `main` 57dea7f23). - Commands and results: - `cargo xtask policy` on 054f0b1e0: passed (554 files ok). - Not run: `cargo clippy --workspace --all-targets --locked -- -D warnings`, the same with `--all-features`, `cargo test --workspace --locked`. The diff is two Markdown files and touches no code. There is no CI upstream, so none of this was checked by CI. - Gameplay, when relevant: not run in game. Nothing in the page is a new measurement. - Before and after, when relevant: not applicable. - Shader wave sizes tested, when relevant: not applicable. - Coverage gaps: - The log line formats and switch names were read in the source on `main` 57dea7f23 (`host.rs` `frame_times_line` and the 5 s `fps` line, `hot.rs`, `README.md` switch rows). I did not start the game to see them in a log. - Nobody else has followed the guide yet, so I do not know where a newcomer gets stuck. That is why this is a draft. - `scripts/bench.ps1` needs the diagnostics build; the page says so, but I did not run it for this change. ## Checklist - [x] This PR contains one change based on `main`. - [x] The diff follows `docs/asset-policy.md`. - [x] I recorded this PR's dependencies below. - Depends on: none ## Spec dependence - Likely general (helps any card): all of it. The method and the log lines do not depend on the GPU; the README row describes what `bench.rs` writes. - May depend on our specs: nothing. The page's example numbers (3 to 5 minutes per run, the last 180 s counted, about 10 % in draws per frame) are starting points, not measurements, and the page says to decide the window beforehand. - Untested elsewhere: not run on any machine. The `DARNER_HOT_AB` and `DARNER_AB` paragraphs say to use them only for a setting known to follow them, and to check the log. ## Checked for overlap - [x] I searched the open pull requests for the same issue and for the files this touches. - Related PRs: none cover the same thing (no open PR adds an A/B or benchmark guide or edits the `DARNER_BENCH_CSV` row). Open PRs that also edit `README.md` (#147, #146, #145, #142, #140, #118, #110, #75, #59, #37, #36, #34, and our own #18 to #9) touch other rows. A trial merge of this branch with each head ended with no README conflict, except that #16, #12 and #9 already conflict with `main` on their own, with or without this branch. Searches for "benchmark", "A/B" and "bench" found issues and PRs that use A/B runs (#145, #76, #2) but none that explain the method. Drafted with AI assistance (Claude Code).
Adds docs/ab-testing.md and links it from the README: run order, warm-up,
one change per arm, which log lines to read (the 5-second fps line and the
frame times line), how to compare against the noise floor, what to report
and common traps. Docs only.

This change was made with AI assistance (Claude Code).
Add a standing-still versus moving section (input record/replay, DARNER_KEYS
from world), point DARNER_BENCH_CSV at the column list in bench.rs and name
the columns that matter, fix the 1 % low as 1000 / p99, A B C C B A for three
arms, same overlays and capture tools in every arm, and a bench-remote note.
Fix the README row that still described DARNER_BENCH_CSV as four columns.

This change was made with AI assistance (Claude Code).
A stray backspace byte had replaced the backslash and the b.

This change was made with AI assistance (Claude Code).
Jesper-A changed title from WIP: [pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds to [pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds 2026-12-04 00:19:45 +00:00
First-time contributor

One correction to the A/B guide at 054f0b1e0: the FPS line is printed about every five seconds, but its FPS value comes from the most recent roughly one-second counting interval. The frame counter and the log timer reset separately. Frame counter · Log timer

I checked this against an archived 45 s run on an i5-13600KF and RTX 4070 Ti SUPER, native 2560×1440, frame generation off, build 8e4b9cd0. Nine printed samples averaged 27.24 FPS. The 1,217 frame intervals in the CSV gave 27.06 FPS over the window, with zero lost rows. The mean of 44 one-second p99s was 56.725 ms. The nearest-rank p99 across the individual frames was 66.845 ms. The CSV and log buckets have slightly different boundaries.

Suggested wording: “For the median of the printed FPS samples, report the median and the number of lines. For average rendered FPS over the whole window, divide 1,000 × the number of complete frame intervals by their total duration in milliseconds. For whole-window p99, calculate it once from the individual frame intervals.”

One correction to the A/B guide at `054f0b1e0`: the FPS line is **printed about every five seconds**, but its FPS value comes from the most recent roughly one-second counting interval. The frame counter and the log timer reset separately. [Frame counter](https://git.gtahub.st/TrustNo1/Darner/src/commit/57dea7f2367c4e902b8ef507f90536564b670b04/crates/darner-gpu/src/host.rs#L19371) · [Log timer](https://git.gtahub.st/TrustNo1/Darner/src/commit/57dea7f2367c4e902b8ef507f90536564b670b04/crates/darner-gpu/src/host.rs#L19516) I checked this against an archived 45 s run on an i5-13600KF and RTX 4070 Ti SUPER, native 2560×1440, frame generation off, build `8e4b9cd0`. Nine printed samples averaged 27.24 FPS. The 1,217 frame intervals in the CSV gave 27.06 FPS over the window, with zero lost rows. The mean of 44 one-second p99s was 56.725 ms. The nearest-rank p99 across the individual frames was 66.845 ms. The CSV and log buckets have slightly different boundaries. Suggested wording: “For the median of the printed FPS samples, report the median and the number of lines. For average rendered FPS over the whole window, divide 1,000 × the number of complete frame intervals by their total duration in milliseconds. For whole-window p99, calculate it once from the individual frame intervals.”
The 'N fps' line is printed about every 5 s but its value covers only the
last ~1 s counting interval; report the median and the line count, and take
whole-window average fps and p99 from the DARNER_BENCH_CSV frame intervals.
The average of the per-second p99s is lower than the whole-window p99.

Reported by akimfomin on #152; figures from akimfomin's run.

This change was made with AI assistance (Claude Code).
Author
Contributor

Thanks for the careful check, you're right: the stats function returns early until about 1 s has passed (host.rs:19337), resets its frame count there (:19376), and prints the fps line only every 5 s (:19516), so each printed value is the last ~1 s, not the 5 s.

Fixed in 12ffb4230, mostly in your wording: the printed lines are reported as their median and count; whole-window average fps is 1000 × complete frame intervals / their total frame_ms from the DARNER_BENCH_CSV file; and whole-window p99 is taken once from the individual frames, with a note that the mean of the per-second p99s comes out lower (your 56.7 ms against 66.8 ms, from your 4070 Ti SUPER run).

Drafted with AI assistance (Claude Code).

Thanks for the careful check, you're right: the stats function returns early until about 1 s has passed (`host.rs:19337`), resets its frame count there (`:19376`), and prints the fps line only every 5 s (`:19516`), so each printed value is the last ~1 s, not the 5 s. Fixed in 12ffb4230, mostly in your wording: the printed lines are reported as their median and count; whole-window average fps is 1000 × complete frame intervals / their total `frame_ms` from the `DARNER_BENCH_CSV` file; and whole-window p99 is taken once from the individual frames, with a note that the mean of the per-second p99s comes out lower (your 56.7 ms against 66.8 ms, from your 4070 Ti SUPER run). Drafted with AI assistance (Claude Code).
Contributor

One addition to the whole-window p99 guidance in 12ffb423: report the p99 over a common interval covered by both CSVs. The writer can drop rows under load (rows_lost, visible as gaps in host_row), and the last quarter-second can be unflushed on title exit. Checking row continuity and the first and last timestamps lets you flag an incomplete window before comparing the two percentiles. Updated guide · CSV writer behaviour

One addition to the whole-window p99 guidance in `12ffb423`: report the p99 over a common interval covered by both CSVs. The writer can drop rows under load (`rows_lost`, visible as gaps in `host_row`), and the last quarter-second can be unflushed on title exit. Checking row continuity and the first and last timestamps lets you flag an incomplete window before comparing the two percentiles. [Updated guide](https://git.gtahub.st/Jesper-A/Darner/src/commit/12ffb4230d0a0a787df8d810d0e83fdccff4c3d7/docs/ab-testing.md#L61-L69) · [CSV writer behaviour](https://git.gtahub.st/TrustNo1/Darner/src/commit/57dea7f2367c4e902b8ef507f90536564b670b04/crates/darner-gpu/src/bench.rs#L27-L36)
First-time contributor

I tried the coverage check on four archived launches (A–B–B–A, RTX 4070 Ti SUPER, frame generation off). Each launch had two scored stages. I took the same 45.000 s from each stage marker and counted only frame intervals whose two endpoints were inside the window.

All eight windows had a CSV row on both sides, consecutive host_row values across both boundaries, zero rows_lost, and successful host presents. The 9,764 complete intervals reproduce the guide’s 66.845 ms whole-window p99 for B1 stage two.

Two controls caught different failures in all eight windows. Removing one interior row produced a host_row gap. Cutting the recording 250 ms before the end left row numbers consecutive, but the last timestamp exposed the missing tail. I’d include both checks in the guide. If either capture ends early, report the comparison as incomplete or state the shorter window used for both runs.

I tried the coverage check on four archived launches (A–B–B–A, RTX 4070 Ti SUPER, frame generation off). Each launch had two scored stages. I took the same 45.000 s from each stage marker and counted only frame intervals whose two endpoints were inside the window. All eight windows had a CSV row on both sides, consecutive host_row values across both boundaries, zero rows_lost, and successful host presents. The 9,764 complete intervals reproduce the guide’s 66.845 ms whole-window p99 for B1 stage two. Two controls caught different failures in all eight windows. Removing one interior row produced a host_row gap. Cutting the recording 250 ms before the end left row numbers consecutive, but the last timestamp exposed the missing tail. I’d include both checks in the guide. If either capture ends early, report the comparison as incomplete or state the shorter window used for both runs.
Before comparing p99s, check each CSV is complete over the window: rows
dropped when the writer falls behind show as rows_lost and a gap in
host_row, and a cut-off tail leaves host_row consecutive, so only the last
timestamp shows it. Compare A and B over the same interval, counting only
intervals with both ends inside it; report the comparison as incomplete,
or use the shorter window for both, if a capture ends early.

Suggested by tyr0nsur on #152; the two checks were tried by akimfomin.

This change was made with AI assistance (Claude Code).
Author
Contributor

Thanks, both of you. Added in 7506dea2a, following tyr0nsur's note and akimfomin's controls: before comparing p99s, check each CSV is complete over the window (rows_lost, gaps in host_row, the last quarter second possibly unflushed at exit). Compare A and B over the same interval covered by both files and count only intervals with both ends inside it. If a capture ends early, say the comparison is incomplete or use the shorter window for both runs. akimfomin showed on four archived A-B-B-A launches that the host_row check catches a lost interior row and the last timestamp catches a cut-off tail.

Drafted with AI assistance (Claude Code).

Thanks, both of you. Added in 7506dea2a, following tyr0nsur's note and akimfomin's controls: before comparing p99s, check each CSV is complete over the window (`rows_lost`, gaps in `host_row`, the last quarter second possibly unflushed at exit). Compare A and B over the same interval covered by both files and count only intervals with both ends inside it. If a capture ends early, say the comparison is incomplete or use the shorter window for both runs. akimfomin showed on four archived A-B-B-A launches that the `host_row` check catches a lost interior row and the last timestamp catches a cut-off tail. Drafted with AI assistance (Claude Code).
Jesper-A changed title from [pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds to WIP: [pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds 2026-12-04 02:24:44 +00:00
Owner

Second-opinion review: merge as is once WIP is dropped. The CSV completeness check from 7506dea2a matches bench.rs: dropped rows are counted in rows_lost and leave a host_row gap, and the last quarter second can be lost at exit. Comparing over the window both files cover and checking the last timestamp is the right rule. The column names, both "frame times" log formats, hot-ab: segment, the DARNER_AB feature gating, bench-remote, scripts\bench.ps1 and F2 all exist as described. No misleading text found.

Second-opinion review: merge as is once WIP is dropped. The CSV completeness check from 7506dea2a matches bench.rs: dropped rows are counted in `rows_lost` and leave a `host_row` gap, and the last quarter second can be lost at exit. Comparing over the window both files cover and checking the last timestamp is the right rule. The column names, both "frame times" log formats, `hot-ab: segment`, the `DARNER_AB` feature gating, `bench-remote`, scripts\bench.ps1 and F2 all exist as described. No misleading text found.
Jesper-A changed title from WIP: [pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds to [pr-docs] How to A/B a change: docs/ab-testing.md, and the DARNER_BENCH_CSV row says what the file really holds 2026-12-04 02:43:33 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u 'up-ab-howto:Jesper-A-up-ab-howto'
git switch 'Jesper-A-up-ab-howto'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'Jesper-A-up-ab-howto'
git switch 'Jesper-A-up-ab-howto'
git rebase 'main'
git switch 'main'
git merge --ff-only 'Jesper-A-up-ab-howto'
git switch 'Jesper-A-up-ab-howto'
git rebase 'main'
git switch 'main'
git merge --no-ff 'Jesper-A-up-ab-howto'
git switch 'main'
git merge --squash 'Jesper-A-up-ab-howto'
git switch 'main'
git merge --ff-only 'Jesper-A-up-ab-howto'
git switch 'main'
git merge 'Jesper-A-up-ab-howto'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
4 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
TrustNo1/Darner!152
No description provided.