mirror of
https://github.com/rommapp/romm.git
synced 2026-06-28 06:46:00 +00:00
perf: pre-normalize exclusions once and use set for O(1) lookup in exclude_multi_roms
Co-authored-by: gantoine <3247106+gantoine@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
9e3f85b085
commit
5a1e238a5f
@@ -377,17 +377,17 @@ class FSRomsHandler(FSHandler):
|
||||
normalized_excluded = {
|
||||
excluded_name.strip().lower() for excluded_name in excluded_names
|
||||
}
|
||||
filtered_files: list[str] = []
|
||||
excluded_files: set[str] = set()
|
||||
|
||||
for rom in roms:
|
||||
normalized_rom_name = rom.strip().lower()
|
||||
if normalized_rom_name in normalized_excluded or any(
|
||||
fnmatch.fnmatch(normalized_rom_name, exc_name.strip().lower())
|
||||
for exc_name in excluded_names
|
||||
fnmatch.fnmatch(normalized_rom_name, exc_name)
|
||||
for exc_name in normalized_excluded
|
||||
):
|
||||
filtered_files.append(rom)
|
||||
excluded_files.add(rom)
|
||||
|
||||
return [f for f in roms if f not in filtered_files]
|
||||
return [f for f in roms if f not in excluded_files]
|
||||
|
||||
def _build_rom_file(
|
||||
self, rom: Rom, rom_path: Path, file_name: str, file_hash: FileHash
|
||||
|
||||
Reference in New Issue
Block a user