A thread remembers what its asks for a buffer's host copy found: 245,000 lookups a frame off the tables' lock, 117 -> 104 ms #1237
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!1237
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1237"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@KyleS98 on GitHub · 2026-11-26 01:26 UTC · original
KyleS98:perf/lookup-cache→main· +98 −0 · 2 files · 1 commits · openWhat
Every bind of a draw asks for the host copy of each buffer it reads (
shadow::find/find_any→lookup). Each ask:The built-in profiler (
VICTORY_PROFILE=1, sampled in the world only) shows what that costs in the prologue cell:shadow::lookupat 54 ms of their time together per frame, underdraw::readable, which is the second-largest part ofState::bind(185 ms a frame over the six threads).They ask for the same ranges again and again. With this PR a thread remembers what each ask (address, length, kind) found:
let_go_idlelooks at the strong count, as before);loosedoes when it hands one out: stampsused, widensasked, and counts unsized asks.VICTORY_LOOKUP_CACHE=0sends every ask to the tables, as before. A line on the frame-rate log counts both kinds.Measured
RTX 3090 Ti, warm cache and pipeline library, prologue cell. Each row is the same binary with the switch off and on, using the README's run-253 switch set plus
VICTORY_CARD_BUFFERS_MIN_KB=64 VICTORY_CARD_BUFFERS_MB=1280.a183ea2+ this PR only9c184b3+ #798 + #1081 + #1171 + #1227 + thisEach "off" figure is one run. On the Series S tree the build before this change measured 77.2 ms in the same spot, so read the gain there as somewhere between 5 and 12 ms.
Picture: the cell is the same with and without, compared from grabs.
What is left in
State::bindBy the same profile, the largest part is
HostHeap::mirrorand what it calls (buffer_copy,make), with 22 ms a frame of the recording threads waiting for its lock. I haven't touched that here.AI-assisted (Claude Code, Claude Fable 5.2); runs and grabs on my machine; no game data.
@UwUCammie on GitHub · 2026-11-26 01:41 UTC · original
I found two stale-cache cases while testing this branch. A recording thread could cache the old buffer under the new generation while registration was waiting for the lock. A loose window could also still be handed out after the idle sweep had removed it. Both regressions fail on
cdf74b5and pass with the fixes on my RX 7900 XT. Fix and focused tests against your branch@SkillIssueXO on GitHub · 2026-11-26 02:36 UTC · original
AI-assisted local A/B on RTX 5070 Ti, Windows, Series X profile. Same warm-cache build from upstream
53c743d7, stationary Gone Fishing boat view,VICTORY_LOOKUP_CACHE=alt. I counted accepted presents in the interior 17 seconds of four consecutive 20-second epochs.In sampled on-mode timing lines, around 205k–233k buffer lookups per frame came from the thread-local cache. Frame time was similar in this boat view with the cache off or on. This measures one stationary scene on this PC.
@KyleS98 on GitHub · 2026-11-26 06:42 UTC · original
@UwUCammie both cases are real, thank you. The first one is plainly my mistake:
registercounted the table change before its insert, so a thread that asked in between kept the old answer under the new count. The maintainer has since carried the cache intomainas32be36d(off by default there,VICTORY_LOOKUP_CACHE=1|alt) and your ordering fix by hand asbc6ee68, from #1245. Somainnow has the corrected form and this branch (cdf74b5) should not be used as it stands.@SkillIssueXO thanks for the paired run. No gain in a stationary view at 150 ms a frame is consistent with what I measured: the saving is lock time on the title's recording threads, and it shows where they are the limit. In the prologue cell on a 3090 Ti that was 54 ms of thread time a frame over six threads (117 -> 104 ms on Series X, 84.6 -> 72.5 ms on Series S, switch off and on, same binary); the maintainer's run 293 puts it at about 14 ms a frame. Where the frame waits on something else, as in your boat view, it gives nothing. I am not claiming a general frame-rate gain beyond those scenes.
Since
mainhas this with the fix, this PR is superseded and can be closed.AI-assisted (Claude Code, Claude Fable 5.2).
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.