mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
refactor: parse emulator profiles once per process
The alias-free profile set was parsed separately from the full one, so a process asking for both read the 534 profiles twice, 1.6 s of a site build. It is now a filter over the full set.
This commit is contained in:
1 parent
1458f68b0d
commit
c07f0d9205
1 file changed
+10
-2
+10
-2
@@ -1784,6 +1784,16 @@ def load_emulator_profiles(
|
||||
cache_key = (os.path.realpath(emulators_dir), skip_aliases)
|
||||
if cache_key in _emulator_profiles_cache:
|
||||
return _emulator_profiles_cache[cache_key]
|
||||
if skip_aliases:
|
||||
# A filter over the full set: parsed once, 534 YAML files cost 1.6 s
|
||||
# every time a process asked for both variants.
|
||||
profiles = {
|
||||
name: profile
|
||||
for name, profile in load_emulator_profiles(emulators_dir, False).items()
|
||||
if profile.get("type") != "alias"
|
||||
}
|
||||
_emulator_profiles_cache[cache_key] = profiles
|
||||
return profiles
|
||||
try:
|
||||
import yaml
|
||||
except ImportError:
|
||||
@@ -1808,8 +1818,6 @@ def load_emulator_profiles(
|
||||
profile = yaml_load(fh) or {}
|
||||
if "emulator" not in profile:
|
||||
continue
|
||||
if skip_aliases and profile.get("type") == "alias":
|
||||
continue
|
||||
_normalize_hash_fields(profile)
|
||||
profiles[f.stem] = profile
|
||||
_emulator_profiles_cache[cache_key] = profiles
|
||||
|
||||
Reference in new issue
Block a user