mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-11 05:53:23 -05:00
perf: read yaml through the c loader
Loading the emulator profiles is the most expensive step of every command here, and all forty call sites used the pure-Python scanner while libyaml sat unused in the same wheel. One shared yaml_load picks the C loader when pyyaml ships it: the 375 profiles parse in 0.18s instead of 1.39s, and verify --platform retroarch drops from 2.17s to 0.73s. The loader class is the same restricted one safe_load uses. es_bios.xml was parsed straight from the network while install.py already refused a document declaring entities; both now share one guard. Scrapers reach it through a single path bootstrap in the package rather than two ad-hoc ones.
This commit is contained in:
1 parent
ab6a3bb26d
commit
3b8f2d75d5
18 files changed
+109
-42
No files matched your search
@@ -10,9 +10,18 @@ from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import pkgutil
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from .base_scraper import BaseScraper
|
||||
# Scrapers run both as `python -m scripts.scraper.x` and as plain scripts, and
|
||||
# they share helpers with the rest of scripts/. Putting that directory on the
|
||||
# path once here is what lets every submodule say `from common import ...`
|
||||
# instead of carrying its own bootstrap.
|
||||
_SCRIPTS_DIR = str(Path(__file__).resolve().parent.parent)
|
||||
if _SCRIPTS_DIR not in sys.path:
|
||||
sys.path.insert(0, _SCRIPTS_DIR)
|
||||
|
||||
from .base_scraper import BaseScraper # noqa: E402
|
||||
|
||||
_scrapers: dict[str, type] = {}
|
||||
|
||||
|
||||
Reference in new issue
Block a user