perf(watch): single-pass ask_once with hoisted OWNED/tell_watch and KEPT fast-path skips #2604

Merged
qlfu merged 1 commit from upstream-pr/2604 into main 2026-11-29 22:54:42 +00:00
qlfu commented 2026-11-29 14:53:52 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by qlfu on 2026-11-29T14:53:52Z.


Summary

Replaces the two-pass watch::ask_once (ask_ahead + ask_rest) with a single-pass ask_once + ask_run_all, hoisting invariant lookups and fast-pathing idle journal operations:

  • Hoists tell_watch() and owned_snapshot() once per ask_once call instead of re-acquiring OWNED.read() and checking tell_watch() per range (~14,400×/frame).
  • Merges ask_ahead + ask_rest into a single pass so Askings and journal_mut() are acquired once per submission instead of twice.
  • Uses an atomic KEPT flag to fast-path ask_once_end(), ask_ahead_done(), ask_ahead(), and wrote() without locking JOURNAL when no asking is held.
  • Uses binary search (ahead_contains) in would_wait.

Verification

  • Unit tests: cargo test -p victory-gpu --lib --locked watch:: -- --test-threads=1 (all watch:: tests pass, including new single_pass_ask_once_caches_mixed_clustered_lone_and_unwatched_ranges).
  • Full crate tests: cargo test -p victory-gpu --lib --locked -- --test-threads=1 --quiet (926 passed; 0 failed; 57 ignored).
  • cargo clippy -p victory-gpu --lib --tests --locked: 0 new warnings.
  • 90s live release run (1440p DLSS Balanced, RTX 4070 Ti + Ryzen 7 5700X): 0 WARNs, 0 ERRORs, watch p95 7.20 -> 6.50 ms.
<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:issue:5551888959 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2604). Originally posted by [qlfu](https://github.com/qlfu) on 2026-11-29T14:53:52Z. --- ## Summary Replaces the two-pass `watch::ask_once` (`ask_ahead` + `ask_rest`) with a single-pass `ask_once` + `ask_run_all`, hoisting invariant lookups and fast-pathing idle journal operations: - Hoists `tell_watch()` and `owned_snapshot()` once per `ask_once` call instead of re-acquiring `OWNED.read()` and checking `tell_watch()` per range (~14,400×/frame). - Merges `ask_ahead` + `ask_rest` into a single pass so `Askings` and `journal_mut()` are acquired once per submission instead of twice. - Uses an atomic `KEPT` flag to fast-path `ask_once_end()`, `ask_ahead_done()`, `ask_ahead()`, and `wrote()` without locking `JOURNAL` when no asking is held. - Uses binary search (`ahead_contains`) in `would_wait`. ## Verification - Unit tests: `cargo test -p victory-gpu --lib --locked watch:: -- --test-threads=1` (all `watch::` tests pass, including new `single_pass_ask_once_caches_mixed_clustered_lone_and_unwatched_ranges`). - Full crate tests: `cargo test -p victory-gpu --lib --locked -- --test-threads=1 --quiet` (`926 passed; 0 failed; 57 ignored`). - `cargo clippy -p victory-gpu --lib --tests --locked`: `0` new warnings. - 90s live release run (`1440p DLSS Balanced`, RTX 4070 Ti + Ryzen 7 5700X): `0 WARNs`, `0 ERRORs`, `watch` p95 `7.20 -> 6.50 ms`.
fvrvxvlyy commented 2026-11-29 23:20:47 +00:00 (Migrated from github.com)

Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by fvrvxvlyy on 2026-11-29T23:20:47Z.


does any one see any character in the game just glitches and goes back normal for 1 sec that makes the fps drop hard

<!-- greyfinch-sync:trustno1-coder/VIctory-NVIDIA:comment:7264389771 --> Imported from [trustno1-coder/VIctory-NVIDIA](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/2604#issuecomment-7264389771). Originally posted by [fvrvxvlyy](https://github.com/fvrvxvlyy) on 2026-11-29T23:20:47Z. --- does any one see any character in the game just glitches and goes back normal for 1 sec that makes the fps drop hard
Sign in to join this conversation.
No reviewers
No labels
No milestone
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.

Reference
trustno1-coder/VIctory-NVIDIA!2604
No description provided.