perf(victory-gpu): cache shader_cache build key per fingerprint and skip disk re-read on miss #406
No reviewers
Labels
No labels
accessibility
bloqué : binaire console
bug
chargeur
console-dll
cpu
documentation
duplicate
enhancement
good first issue
gpu
help wanted
invalid
performance
question
runtime-gdk
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/LooperSalty--AnyXboxX!406
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-406"
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?
@Lewandox on GitHub · 2026-11-26 17:38 UTC · original
Lewandox:perf/shader-cache-avoid-rehash-and-reread→main· +70 −15 · 1 files · 1 commits · closed without mergingSummary
Eliminates repeated BLAKE3 re-hashing of
shader_cache.rson every lookup and avoids redundant disk re-reads/re-decodes on cache misses (third_party/victory/crates/victory-gpu/src/shader_cache.rs):build()key pertranslation_fingerprint()(100% bit-identical key):build()re-hashedinclude_bytes!("shader_cache.rs")(~15 KiB) with BLAKE3 on every single shader cache lookup (thousands of shaders at startup and on every reload withVICTORY_DROP_DXIL=1).[u8; 32]key against the lasttranslation_fingerprint()so lookups reuse the exact same BLAKE3 key in O(1) while still immediately recomputing if the device probe changes the fingerprint (preserving 100% on-disk cache compatibility).Translate::convert()translated a shader and wrote the encoded entry to disk,cached()immediately calledstd::fs::read(&path)anddecode(&b), reading the file back from disk and allocating a duplicateHostShader+dxilbuffer.Translatenow retains the freshly producedHostShadersocached()returns it directly on a miss while keeping the exact on-disk write and hit/corrupt-recovery paths unchanged.encode()buffer:Vec::with_capacity) instead of growing from 4 bytes through repeated reallocations.build_forreturns the exact same hash as full recomputation and updates immediately whentranslation_fingerprintchanges.encodeallocates the exact serialized size without spare reallocations, and all existing round-trip / corrupt-cache-recovery tests continue to pass.Verification
cargo test -p victory-gpu --lib shader_cache::tests(default and--features diagnostics)cargo xtask policyinsidethird_party/victory977a36ca3fto28f5f9e44428f5f9e444to233dcf3d38@LooperSalty on GitHub · 2026-11-26 23:09 UTC · original
Closing after #454 moved
third_party/victoryto the Vice-Tay base (TaynanGT/Vice-Tay a252348).Vice-Tay already keeps translated shaders in memory instead of re-reading the disk on a miss; the rest (hashing the key per lookup) came without a measurement.
Thanks for the work. If you measure a gain on the new base, a new PR against
mainis welcome.🤖 Closed by Claude Code on behalf of the maintainer
Pull request closed