Repository navigation
Conversation
… times open_decision_for checked the overlay and the original (visible_in_overlay, visible_in_original) before deciding whether an open writes, then read_path_rel checked the overlay again. For a read (no write access, not OPEN_ALWAYS) the first two answers are never used: the decision is the same read_path_rel. Each check is a std::fs::metadata, which costs about as much as the title's open itself. Measured on 200 game files (release, median of 15 rounds, RX 9060 XT box, Windows 11 26300): open_decision 65 -> 19.5 us, open_decision plus the open 94 -> 50 us, against 23 us for a bare File::open. Fixes xcl-dev#999 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sds-228
approved these changes
Nov 24, 2026
sds-228
left a comment
There was a problem hiding this comment.
Reviewed head 639397a. cargo test -p xcl --lib vfs → 24 passed, 0 failed here. The plain-read fast path excludes every write-like open: is_write covers write access, CREATE_NEW, CREATE_ALWAYS, TRUNCATE_EXISTING and delete-on-close, with OPEN_ALWAYS checked separately. Paired smoke block shows 1500 frames against main's 1434. No issue found.
AI-assisted (OpenCode).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every
CreateFileW/CreateFileA/CreateFile2of a game file goes throughVfs::open_decision. For a read,open_decision_forcalledvisible_in_overlayandvisible_in_originalto work out whether the open writes, thenread_path_relcalledvisible_in_overlayagain. A plain read (no write access, notOPEN_ALWAYS) never uses the first two answers: the decision is alwaysread_path_rel's. Each check is astd::fs::metadata, which costs about as much as the title's open itself. Now a plain read goes straight toread_path_rel.OPEN_ALWAYS,TRUNCATE_EXISTING, delete-on-close and any write access take the unchanged path. Fixes #999.Measured with a scratch benchmark (not part of the PR): 200 game files under a
G:mount, release build, median of 15 rounds of 200 opens. Main and this PR were run back to back three times, and the table gives the median of the three runs.GENERIC_READ,OPEN_EXISTING)47efa2eopen_decisionopen_decision+File::openof its pathFile::open(reference)The remaining check is the overlay copy, which costs almost as much on a path that doesn't exist. Skipping it while the overlay is empty is its own PR.
What is in it
crates/xcl/src/vfs.rs: the early return for a plain read inopen_decision_for, andreads_take_the_original_and_read_only_open_always_still_creates, which pins the edge of the fast path: a read-onlyOPEN_ALWAYSof a missing file still creates it in the overlay. The existingreads_never_touch_and_writes_copy_on_write,delete_is_a_persistent_whiteoutandtruncate_existing_validation_errorscover the read and validation decisions and pass unchanged.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at639397a(on main47efa2e), two runs:e2elost its GPU at "coherent window headroom" ("GPU fence 1 not reached", then 0x887A0005 for the GPU checks after it). No file check failed.cargo test -p xcl --test e2ealone, three times: 3 passed each time.cargo test -p xcl --lib vfs: all VFS tests pass excepttruncate_existing_validation_errors, which fails when it's the first test to callunder_wine()(127 instead of 5, on main too); Tests: capture the truncate error before checking for Wine #633 fixes that test.Regression run
The title's 60 s smoke run (
scripts/smoke.ps1, release builds, same machine, back to back with a warm shader cache).main:
PR:
Not tested
AI use
🤖 Generated with Claude Code