Merge pull request #198 from bhoot1234567890/fix/issue-195-macos-wxapp-warmup
fix: macOS wxApp warm-up + symbol cache eager loading (#195)
This commit is contained in:
@@ -55,6 +55,21 @@ class SymbolLibraryManager:
|
||||
self.libraries: Dict[str, str] = {} # nickname -> path mapping
|
||||
self.symbol_cache: Dict[str, List[SymbolInfo]] = {} # library -> [SymbolInfo]
|
||||
self._load_libraries()
|
||||
self._warm_cache()
|
||||
|
||||
def _warm_cache(self) -> None:
|
||||
"""Pre-parse all symbol libraries so the first search is fast.
|
||||
|
||||
Without this, the first ``search_symbols`` call parses every
|
||||
.kicad_sym file on demand, which can take 30-120 s across
|
||||
200+ libraries. By populating the cache here (during startup,
|
||||
before the READY handshake) the cost is paid once.
|
||||
"""
|
||||
for nickname in list(self.libraries.keys()):
|
||||
try:
|
||||
self.list_symbols(nickname)
|
||||
except Exception:
|
||||
logger.debug("Skipping unparseable library: %s", nickname)
|
||||
|
||||
def _load_libraries(self) -> None:
|
||||
"""Load libraries from sym-lib-table files"""
|
||||
|
||||
Reference in New Issue
Block a user