The views table is a read-write lock: list recorders only read it #18

Open
github-bot wants to merge 1 commit from github-bot/gh-18 into main AGit
Owner

@⁠Daayben on GitHub · 2026-11-25 18:38 UTC · original
Daayben:pr/views-rwlock → main · +13 −9 · 1 files · 1 commits · open

descriptor::VIEWS becomes a RwLock. List recorders read it for every descriptor they bind. Belobug's PIX timing capture showed the title's five recording threads taking turns on the mutex, at 6,600 context switches a second each.

Read lock: view, view_at (table entries and placed_of), views_kept, and the two lookups in the tests.
Write lock: words_for (shape() may add a shape, entry() an entry) and forget.

Adapted from Belobug/VIctory-Belobug-AMD ff920f2 (beloooo, credited as co-author). This tree's table has shapes and placed views that the original did not, so the patch does not apply as is.

Measured effect: Belobug saw no frame-time change from this alone (4.2 to 5.8 fps either way). The submit thread is the limit there. I have not measured it in the game.

Checked on Windows 11, RTX 4090, i9-10900F:

  • cargo clippy --workspace --all-targets --locked -- -D warnings, and the same with --all-features: clean
  • cargo test --workspace --locked: 634 passed, 0 failed, 11 ignored
  • cargo test --locked --release -p victory-gpu: 188 passed, including the 23 descriptor tests

🤖 Generated with Claude Code

**@⁠Daayben** on GitHub · 2026-11-25 18:38 UTC · [original](https://github.com/DexNom/VIctory/pull/18) `Daayben:pr/views-rwlock` → `main` · +13 −9 · 1 files · 1 commits · open `descriptor::VIEWS` becomes a `RwLock`. List recorders read it for every descriptor they bind. Belobug's PIX timing capture showed the title's five recording threads taking turns on the mutex, at 6,600 context switches a second each. Read lock: `view`, `view_at` (table entries and `placed_of`), `views_kept`, and the two lookups in the tests. Write lock: `words_for` (`shape()` may add a shape, `entry()` an entry) and `forget`. Adapted from Belobug/VIctory-Belobug-AMD ff920f2 (beloooo, credited as co-author). This tree's table has shapes and placed views that the original did not, so the patch does not apply as is. **Measured effect:** Belobug saw no frame-time change from this alone (4.2 to 5.8 fps either way). The submit thread is the limit there. I have not measured it in the game. Checked on Windows 11, RTX 4090, i9-10900F: - `cargo clippy --workspace --all-targets --locked -- -D warnings`, and the same with `--all-features`: clean - `cargo test --workspace --locked`: 634 passed, 0 failed, 11 ignored - `cargo test --locked --release -p victory-gpu`: 188 passed, including the 23 `descriptor` tests 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Every list recorder reads the table for every descriptor it binds. As a
mutex it made the title's five recording threads take turns: a PIX timing
capture by beloooo showed 6,600 context switches a second each. view,
view_at, placed_of and views_kept now share a read lock; words_for (which
may add a shape or an entry) and forget take the write lock.

Belobug measured no change of the frame time from this alone (4.2 to 5.8
fps either way): the submitting thread is what a frame waits for there.

Adapted from Belobug/VIctory-Belobug-AMD ff920f2 to this tree's table,
which has grown shapes and placed views since. Checked: cargo clippy
(with and without all features, -D warnings) and cargo test --workspace
(634 passed, 0 failed) on an RTX 4090.

Co-Authored-By: beloooo <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:31:51 +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 origin '+refs/pull/18/head:github-bot/gh-18'
git switch 'github-bot/gh-18'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-18'
git switch 'github-bot/gh-18'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-18'
git switch 'github-bot/gh-18'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-18'
git switch 'main'
git merge --squash 'github-bot/gh-18'
git switch 'main'
git merge --ff-only 'github-bot/gh-18'
git switch 'main'
git merge 'github-bot/gh-18'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.