Skip to content

Conversation

@zoltanvb
Copy link
Contributor

Description

Extend scanning logic by filtering databases, so that queries that will certainly be unsuccessful, are skipped.

Filtering criteria:

  • size of scanned file between smallest and largest file in DB
  • presence of serial in database (when looking for serials)

Two extra queries for min and max are run for each database on the first scan, this causes single-file scans to be somewhat slower, but it pays off with large scans (~20% on a desktop system when scanning a NES set).

Archive size is also checked. The built-in shortcut of scanning both the archive (zip file) and the first (possibly only) file inside the archive is kept unchanged, it makes logic more complicated, but the speed difference is significant for sets that contain one zipped file per title.

Tested with several different content types, produces same results as previously (just a bit faster, in case of large sets).

Very verbose logs added to debug builds - they actually slow the scanning down, so I did not want it to be part of regular builds.

Related Issues

Fixed one issue when some playlist entries were added to playlist with previously matched serial number instead of the valid CRC (not sure if it had any effect on usage).
Removed an undocumented shortcut: if scanned folder matched the database name exactly, scan was limited to that database. I plan to re-introduce a similar option later (use first match).
Serial scan inside archives does not work primarily because of a shortcut (line 1557), but even if it was removed, there are some remaining issues. This PR does not change anything in that respect.

Could not reproduce #15712 during all the experiments.

Related Pull Requests

Preparatory work:
libretro/libretro-database#1581
#18314
#18315

Extend scanning logic by filtering databases, so that queries that
will certainly be unsuccessful, are skipped.

Filtering criteria:
- size of scanned file
- presence of serial (in case of serials)

Two extra queries for min and max are run for each database on the
first scan, this causes single-file scans to be somewhat slower,
but it pays off with large scans.

Archive size is also checked. The built-in shortcut of scanning
both the archive (zip file) and the first (possibly only) file
inside the archive is retained, it makes logic more complicated,
but the speed difference is significant for sets that contain
one zipped file per title.
@LibretroAdmin LibretroAdmin merged commit 768c2bf into libretro:master Nov 4, 2025
31 checks passed
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.

2 participants