perf(M01): 로직·조합 목록이 마스터를 한 번만 읽고 막힘은 미리 세어 둠 (일감 32)

- `_Store_Cache` 신설 — 자국(시각·크기)이 바뀐 파일만 다시 읽음 · 목록은 검사를 돌리지 않고 세어 둔 막힘을 씀
- 요소·표가 바뀌면 모든 로직을, 로직 파일이 바뀌면 그 파일과 그 로직을 부르던 줄만 다시 셈
- 저장 뒤에는 고친 파일을 바로 다시 읽게 알려 줌 — 저장 직후 목록 2.5초 → 0.06초
- `/logics` 둘째 번부터 2.5초 → 0.02초 · `/combos` 0.3초 → 0.01초 · 켠 뒤 첫 번만 3.4초
- 시험 `test_m01_cache.py` 다섯 — 세어 둔 막힘이 줄마다 검사한 값과 같음 · 거름 그대로 · 저장 직후 비침

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JgUhN55Z3BCYhUJTjwTNfj
This commit is contained in:
2026-09-22 02:17:49 +09:00
co-authored by Claude Opus 5
parent e3e8fc15e2
commit 3c6e68231c
6 changed files with 270 additions and 14 deletions
+3 -4
View File
@@ -103,8 +103,7 @@ def _brief(whole, row: dict) -> list[dict]:
def combos(sub: str = "", detail: str = "", q: str = "", owner: str = "") -> list[dict]:
"""조합 목록 — 구분 · 상세구분 · 소유 · 찾기로 거름."""
files = cm.load(folder=store.FOLDER)
whole = cm.mf.Master(files)
files, whole = store.loaded()
out = []
for _, row in mcb.rows(files):
if (sub and row.get("구분") != sub) or (detail and row.get("상세구분") != detail):
@@ -130,7 +129,7 @@ def combo(key: str) -> dict:
"""조합 하나 — 담은 로직에 이름·단위를 붙여 줌."""
data, version = _read()
row = _find(data, key)
whole = cm.mf.Master(cm.load(folder=store.FOLDER))
whole = store.loaded()[1]
problems = mcb.check_row(whole, row)
return {
"file": FILE,
@@ -144,7 +143,7 @@ def combo(key: str) -> dict:
def combos_of_logic(key: str) -> dict:
"""「이 로직을 쓰는 조합」 — 로직 화면이 거꾸로 볼 때(소요량 「용도」 와 같은 결)."""
files = cm.load(folder=store.FOLDER)
files, _ = store.loaded()
return {"key": key, "combos": mcb.using(files, key)}