Repository navigation
Conversation
Most titles never write their game folder, so the overlay holds nothing, yet every read open of a game file asked the file system for an overlay copy (visible_in_overlay, a std::fs::metadata costing about as much as the open). The VFS now keeps a flag: set at start when the overlay folder holds anything besides the whiteout list (an earlier run's copies), and by stage_write, prepare_write and create_dir before they create anything there, the only ways the VFS puts things into the overlay. While it is clear, visible_in_overlay, is_dir and needs_merge answer without asking the file system about the overlay (needs_merge runs before every FindFirstFile in a game folder). Measured on 200 game files (release, median of 15 rounds, three runs): open_decision 65 -> 33.5 us alone; with the change that skips the unused checks for plain reads (xcl-dev#999), 65 -> 2.0 us, and a read open costs about a native open (29-36 us against 25-30 us bare, was 94 us). The checks before a FindFirstFile in a game folder (is_dir + needs_merge): 114 -> 58 us, against 61 us for the search itself. Part of xcl-dev#999 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
DTsordas
marked this pull request as ready for review
November 24, 2026 13:19
sds-228
reviewed
Nov 24, 2026
sds-228
left a comment
There was a problem hiding this comment.
Reviewed head 3efb59f. cargo test -p xcl --lib vfs → 24 passed, 0 failed here. Paired smoke blocks are present. The overlay_used gating looks sound: the writers set the flag before creating anything in the overlay, and the earlier-run/whiteout-only cases have tests.
Question: the PR's 60 s smoke block reports 1223 frames against main's 1434 (about 15% fewer), although both end at 60 presents per 2 s. For a change meant to cut per-open cost, is that difference expected run-to-run noise? Otherwise 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.
Part of #999, and independent of #1092 (either can merge first). Most titles never write their game folder, so the overlay holds nothing, yet every read open of a game file asked the file system whether an overlay copy exists (
visible_in_overlay, astd::fs::metadatathat costs about as much as the open). So did every directory search in a game folder (is_dirandneeds_mergebeforeFindFirstFile).The VFS now keeps
overlay_used. It's set at start when the overlay folder holds anything besides.xcl_whiteouts(an earlier run's copies), and bystage_write,prepare_writeandcreate_dirbefore they create anything there. Those are the only ways the VFS puts things into the overlay: a move within the overlay needs an existing entry, andReplaceFileWon game paths goes through theCopyFileW/MoveFileExWhooks. While the flag is clear,visible_in_overlay,is_dirandneeds_mergedon't ask the file system about the overlay. Something put into the overlay folder by hand during a run is seen from the next run on.Measured with scratch benchmarks (not part of the PR): 200 game files and 200 game folders under
G:, release build, median of 15 rounds of 200, three runs each. The table gives the median of the three runs, with the runs in brackets.47efa2eopen_decision, a read openopen_decision+File::openFile::open(reference)is_dir+needs_mergebefore aFindFirstFileread_dir+ first entry (reference)For the directory rows, the "main" column is an overlay holding an earlier run's copy, which asks the file system as main does. Together with #1092, a read open asks it nothing extra: on an earlier main (
077ce40),open_decisionwent from 65 µs to 2.0 µs with both changes. What's left of the directory checks isis_dirasking the original twice (exists, then is a folder), which is left for its own PR.What is in it
crates/xcl/src/vfs.rs:overlay_used(set inVfs::newfrom the overlay folder, and bymark_overlay_usedin the three writers), checked first invisible_in_overlay,is_dirandneeds_merge.an_overlay_from_an_earlier_run_is_seen_but_a_whiteout_list_alone_is_none(a newVfsover an overlay holding only the whiteout list keeps the flag clear and still hides the deleted file; over an earlier run's copy, it reads the copy). Alsoan_empty_overlay_is_not_asked_until_this_run_writes_to_it: a file and a folder put there behind the VFS's back are not looked for until the VFS writes there. Withvisible_in_overlayalways probing, as on main, the latter fails.remove_dir_checks_both_layers_before_removing_overlay(from47efa2e) creates its overlay folder directly on disk, so it now marks the overlay used after that, as a run that found the folder at start would. Its assertions are unchanged.Tested
cargo test --workspace --no-fail-fast -- --test-threads=4at3efb59f(on main47efa2e): 743 passed, 0 failed, 41 ignored, 0 SKIPPED, includinge2e'stest_title_runs_and_game_folder_is_untouched.cargo test -p xcl --lib vfs: 24 passed.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