Files: a title's read-only opens go through the host file cache (VICTORY_FILE_CACHE=0: unbuffered, as before) #423
No reviewers
Labels
No labels
accessibility
already-solved
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
merged
needs-decision
needs-game-run
needs-rebase
not-merged
nvidia
obsolete
question
security
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/avatarmanz--VIctory-7900XTX!423
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-423"
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?
@Jesper-Andersson on GitHub · 2026-11-27 02:26 UTC · original
Jesper-Andersson:worktree-file-cache→main· +67 −0 · 1 files · 1 commits · openFixes #422.
The title opens its packs read-only with
FILE_FLAG_NO_BUFFERING, andfiles::CreateFileW(crates/victory-hle/src/modules/files.rs:263) passes the flag on to the host unchanged. On Windows the flag keeps every read of those files out of the system file cache, so every launch reads the same bytes from the drive again. On an RTX 2070 SUPER / 32 GB PC with the game on a SATA SSD, letting those opens use the cache cut launch to the title-screen logo from 34-37 s to 21-23 s.Change
files::host_flags(new) is called byCreateFileWandCreateFileAbefore the host's open. An open whose access is exactlyGENERIC_READand which is not overlapped losesFILE_FLAG_NO_BUFFERING(files::dropped_flags). A buffered handle returns the same bytes for the same aligned reads, and also takes unaligned ones, which an unbuffered handle refuses. An overlapped open keeps the flag:ReadFileScatterneeds a handle with both, and a buffered handle may finish an overlapped read inside the call.CreateFileAgets the same rule (it goes to the host'sCreateFileWanyway), and the title's unbuffered opens are logged (the first 8, then every 256th), so a log shows whether the switch can change anything.VICTORY_FILE_CACHE=0keeps the flag, as before. On by default.Where it does nothing
read_only_opens_lose_no_buffering).CreateFile2(used by Bink) keeps its flags. They sit in a structure of the caller's.dstorage.rsopens handles of its own, which already go through the cache by default (VICTORY_DSTORAGE_IO=handles).Measured
RTX 2070 SUPER 8 GB (driver 621.14), Ryzen 7 5800X, 32 GB, Windows 11, game on a SATA SSD (Samsung 870 QVO). Local branch
test-perf@ 64c3742 plus this commit (the numbers come from that branch, not frommain), diag build,scripts\play.ps1 -NoWarm, Series S, DLSS, intro movies skipped. Four launches one after another, each closed at the title screen. Timed from the first log line to the start of the 2560x1440 logo movie, which comes before the title waits for a key.VICTORY_FILE_CACHEThe log showed the title opening 8 files unbuffered, all
access=0x80000000,flags=0x20000000, none overlapped. Each run logged the same 8 refused compute pipelines this card always has (#70), and nothing new. B1, the first launch with the cache on, was already as fast as B2. Frame times in game are not what this changes, and they were not compared.Checks
cargo test -p victory-hle --locked: 160 passed, 2 ignored (new:modules::files::tests::read_only_opens_lose_no_buffering)cargo test -p victory-hle --all-features --locked -- --test-threads=1: 160 passed, 2 ignoredcargo clippy --workspace --all-targets --locked -- -D warnings: fails on errors already onmain(014d52d), none in changed code: 4transmute used without annotationsincrates/victory-loader/src/descriptor_sites.rs, and invictory-gpu(list.rstotalsunused,host/panel.rs,host/place.rs,watch.rs, and with--all-featuresalsotexture.rs,host/rtstamps.rs).cargo clippy -p victory-hle --all-targets [--all-features]: no warnings invictory-hlecargo xtask policy: 272 files okNot checked
FILE_FLAG_NO_BUFFERINGdoesn't reach the host asO_DIRECT, so both kinds of open already read through Linux's page cache.Related
files.rspart.files.rs, but only how..is resolved in paths.This change was made with AI assistance (Claude Code).
@UwUCammie on GitHub · 2026-11-27 02:55 UTC · original
I checked the host I/O path on Wine 11.22. Two generated files returned the same bytes from aligned 4 KiB reads.
FileModeInformationdistinguished the ordinary andFILE_FLAG_NO_BUFFERINGopens (0x20and0x28). Their Linux file descriptors had identical open flags, and neither usedO_DIRECTon this setup. So the Windows title-logo result may not carry over to this Wine path. Probe and result@Erick-Franco on GitHub · 2026-11-27 03:07 UTC · original · approved these changes
@Jesper-Andersson on GitHub · 2026-11-27 03:29 UTC · original
Thanks for checking. That fits: under Wine both opens already go through Linux's page cache, so the switch should neither help nor hurt there, and the gain is Windows-only. I've put that in the PR's "Not checked" section: on Wine/Proton,
NO_BUFFERINGdoesn't reach the host asO_DIRECT(your e036355b), so expect no change.This comment was written with AI assistance (Claude Code).
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.