Files
romm/backend/endpoints
Sam Dornan 7c8778cc77 perf(scan): read only the selected ROMs' gamelist entries (#4940)
* perf(scan): read only the selected ROMs' gamelist entries

A scan of hand-picked ROMs warmed the gamelist cache by parsing the
platform's whole gamelist.xml. Every media tag of every entry goes
through validate_path, which stats each path component, so a 1,500
entry gamelist costs ~160k lstat calls. On a network mount that stalled
a one-ROM rescan for ~45 seconds before hashing started.

populate_cache now takes the file names to limit the parse to, and the
cache records that scope so a lookup outside it (a ROM renamed mid-scan,
or an overlapping library scan) still parses the full file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KakznhQRBWTSARmmsYLXHQ

* perf(scan): widen a limited gamelist cache instead of reparsing it all

A selected ROM renamed mid-scan (Switch title-ID embedding) is looked up
under a name outside the cache's scope, which fell back to a full parse
and brought the stall back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KakznhQRBWTSARmmsYLXHQ

* perf(scan): widen a limited gamelist cache by the missing names only

Each widening re-resolved every name already cached, so a batch of
Switch ROMs renamed mid-scan cost quadratic media resolution. Only the
names the cache lacks are read now, merged into the cached entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KakznhQRBWTSARmmsYLXHQ

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-29 09:22:55 -05:00
..
2026-03-08 14:51:28 -04:00