Repository navigation
Switch: list the SD card once for the disc index, without a stat per file - #43
Open
TomasUribe wants to merge 1 commit into
Open
TomasUribe wants to merge 1 commit into
TomasUribe wants to merge 1 commit into
Conversation
…file Starting Retro Rewind spent most of its time in DVDInit's disc index: Retro Rewind's pack has thousands of files, and std::filesystem asks for each one's type and size separately, several file system requests each on the Switch (the entry's type, then open, size and close). - WalkDirectory lists sdmc:/ folders with fsDirRead (switch_sd_list.cpp), which carries every file's size, and hands its visitors the size it already has. Elsewhere, or for a folder that cannot be opened this way, it walks with std::filesystem as before. - Riivolution's file and folder patches, and the disc index's single-file mappings, take their type and size from one cached listing of each folder (SwitchSdList::Lookup): Retro Rewind's XML names 152 files, which were a stat or two each. Anything the listing can't answer still stats. Measured on a Switch (Mariko, Retro Rewind 6.13.5): the disc index is 2037 disc files plus 5454 overlay registrations in 1980 ms, and the first game frame comes 9.6 s after the launcher hands over; the startup cover used to sit still for about 55 s here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
On Switch, starting Retro Rewind spent most of its time in DVDInit's disc index. The pack has thousands of files, and walking them with
std::filesystemasks for each file's type and size separately. On the Switch that's several file system requests per file (the entry type, then open, get size, close), so the startup cover sat still for close to a minute.This lists the SD card with its own directory reads instead:
WalkDirectorylistssdmc:/folders withfsDirRead(newswitch_sd_list.{h,cpp}), which returns every file's size along with its name. The visitors now get that size (WalkEntry) instead of statting each entry again. Other platforms, and any folder that can't be opened this way, walk withstd::filesystemexactly as before.<file>/<folder>existence checks (RiivoCollectMappings) and the disc index's single-file mappings take their type and size from one cached listing of each folder (SwitchSdList::Lookup). Retro Rewind's XML names 152 files, each a stat or two before. Anything the listing can't answer, such as a name spelled with different case, still falls back to a stat.The resulting index is the same: same entries and sizes, in the order
recursive_directory_iteratorgives (a folder before its contents).Measured on my Switch (Mariko, Atmosphère 1.12.1, firmware 23.0.1, Retro Rewind 6.13.5, build from source): the disc index is 2,037 disc files plus 5,454 overlay registrations in 1,980 ms. The first game frame comes 9.6 s after the launcher hands over; before, the startup cover sat still for about 55 s at this point. The game played normally afterwards, online included.
🤖 Generated with Claude Code