Files: read the game's archives through the Windows file cache (faster loading) #941
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/941"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by aidanthehorrible on 2026-11-28T09:29:38Z.
What
The title opens each of its archives twice. The second open uses
FILE_FLAG_NO_BUFFERING(63 of the 127 opens in a run). At loading it then reads them in about 80,000 small synchronousReadFilecalls, one at a time. Most calls are 4 KiB or less.The console's storage serves reads like these in microseconds. Unbuffered on a PC, every call waits for the drive. On a SATA SSD each one took about 1 ms, so the loading screen ran for 70-76 s. During that time the drive read only about 5 MB/s at 99% busy, and the CPU was idle.
With this change, a read-only open (no write access asked for) goes to the host without
FILE_FLAG_NO_BUFFERINGandFILE_FLAG_RANDOM_ACCESS. The host's file cache and read-ahead then serve the reads. The bytes the title gets are the same, since an unbuffered handle only adds alignment rules. Opens for writing keep their flags.VICTORY_FILE_BUFFERED=0goes back to the title's own flags.crates/victory-hle/src/modules/files.rs: 154 lines added, none removed.How it was found
Windows performance counters were recorded during loading (
typeperf).victorydid all the reading. Microsoft Defender read 0 bytes, and an exclusion made no difference.VICTORY_DSTORAGE_LOG, DirectStorage made only 51 requests in that window. Its burst right after (90k requests, 2.5 GB) was fast.ReadFilecalls. A log of the flags on each open showed theNO_BUFFERINGhandles.Results
RTX 5070 Ti 16 GB, Ryzen 7 7800X3D, 32 GB. Game on a SATA SSD. Windows 11, Series X profile, 1440p, DLSS Quality, release build.
Metric: time from the start of the log to the first frame of the world (over 1,000 draws).
ReadFilecalls in 3.5-5.5 s, at 4 µs each. On a cold start there is one extra burst of 23,079 calls at 18 µs each.Who gains
The gain scales with how long the drive takes to answer one small read, multiplied by the ~80,000 reads:
An HDD before/after is planned and will be added here.
Log
ReadFilecalls in 2 s) get a summary line: calls, how many were 4 KiB or less, MB, and µs per call. Outside loading the log stays quiet.🤖 Generated with Claude Code
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by aidanthehorrible on 2026-11-28T09:40:57Z.
Credit where it's due: after posting I found that @imjustprism made the same core change in Marvisak/VIctory#2427 (Nov 25, still open there), with HDD numbers: 49 s -> 21 s cold, about 7x on later starts. We found the cause independently through our own measurements, and this PR brings it to VIctory-NVIDIA with SATA SSD numbers.
Following #2427, the second commit keeps the flags of overlapped opens (ReadFileScatter needs no buffering). The title only opened its packs synchronously in our runs, so the results above stand.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by ArturoWolff on 2026-11-28T10:16:29Z.
Independent Proton/NVMe data point for aidanthehorrible's PR and imjustprism's earlier #2427. Tested head
1f3f24a1da51bb904b9d372c31f882781e765fe5(the current rewritten head082c5c3679b01c561698eb62e76bdec97a36da9ehas the identical Git tree0f26ea75597bfb68aec295fda7c4c8e1d40a274a). Applied only itsfiles.rsdelta onto our already-tested #925 helper compiler + Linux backing baseline. RTX 4060 8 GB / 16 GB RAM, NVIDIA 620.73.04, GE-Proton11-14, Series X 1080to1440, DLSS/FG off, normal waits and full requested effects/write-back. Same release executable, cloned profile, fresh external caches, off then on; host page cache not forcibly cleared.VICTORY_FILE_BUFFERED=0=1NO_BUFFERINGopen, flags sent0x200000000x000000000x800x80The receiving path is exercised: the policy changes the expected read-only open flags, and the observed read/write flags stay the same. The host call timing is lower in the buffered arm, but requested bytes are not matched, the cache state is uncontrolled at host level, and these are rounded logged windows rather than complete read traces (requested lengths, not completed bytes). This pair does not establish a causal speedup magnitude, byte equivalence, all overlapped/write semantics, or total loading improvement. Both actual runs still end at the existing #628 loading failure (black overlay, no playable world); no memory guard stop, OOM, GPU fault or reported device/fence/host upload refusal. The unbuffered baseline already reports microsecond-scale host calls here rather than SATA's millisecond-scale calls, so this looks less promising as the immediate local world-entry fix. No game data or raw logs attached.
AI assistance: Hermes Agent, working on behalf of ArturoWolff. (GPT 6.2 Sol High).
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by aidanthehorrible on 2026-11-28T17:20:02Z.
HDD test, as promised. Same PC, game copied to an HDD, cold start after a restart each time:
About 47 s faster on a cold HDD start. Smaller in proportion than on my SATA SSD, because most of the HDD's loading time goes to scattered reads that this change doesn't touch.