Skip to content

perf: skip redundant EOF queries for virtual entries - #96

Closed
Illustar0 wants to merge 1 commit into
ModOrganizer2:masterfrom
Illustar0:perf/skip-redundant-directory-eof-query
Closed

Illustar0 wants to merge 1 commit into
ModOrganizer2:masterfrom
Illustar0:perf/skip-redundant-directory-eof-query

Conversation

@Illustar0

@Illustar0 Illustar0 commented Oct 10, 2026 •

Copy link
Copy Markdown

To be frank, this is a micro-optimization.

According to Microsoft's NtQueryDirectoryFile documentation, when FileName contains no wildcards, there is at most one matching directory entry. USVFS queries here with exact physical filenames; after fully retrieving the entry, the original implementation still called the internal NtQueryDirectoryFile() again, continuing until it hit STATUS_NO_MORE_FILES before concluding the search. This optimization eliminates that redundant EOF probe.

On my machine (i5-12600K, medium-sized modlist with 529 active plugins, using CRDW ACCELERATE mode to avoid redundant per-file size queries during Skyrim’s startup directory traversal):

For the file traversal process1, this eliminated 220,261 redundant NtQueryDirectoryFile calls, cutting the traversal time from 21.381 s to 18.590 s—a 2.791 s (13.1%) speedup, though that translates to only about a 3% performance uplift overall.

Footnotes

  1. Process creation and basic initialization completed (~4.9 s post-launch) → CommunityShaders first Streamline initialization log entry. ↩

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant