chessbaseLinux/claude/memory/search-performance-plan.md

31 lines
1.7 KiB
Markdown
Raw Normal View History

---
name: search-performance-plan
description: "Large-base search performance work (2026-10-19): own booster, opening index with RAM check, PGN memory guard, --bench — done locally, not yet pushed/released"
metadata:
node_type: memory
type: project
originSessionId: 86c7ee93-82be-4380-9d11-393872d0bb51
modified: 2026-10-19T16:24:32.309Z
---
On 2026-10-19 the user asked for an audit of filtering/search algorithms and said
"делать всё как ты предлагаешь"; they want RAM used when available ("не жалел бы
оперативку"), a slower path otherwise, and laptops to cope.
Done (commits a7d9d59, 1506ebd, 4b92fa3 on main, as of 2026-10-19 evening, unreleased):
- own `.cbb`-format booster in the cache when the base has no usable one (`chessbase/booster.rs`);
booster skipped for early positions (sampling the first 4096 records);
- opening index `chessbase/openings.rs` (first 10 plies, 600 MB for Mega, built in the same
pass, loaded only when `memory::available()` ≥ size + 1 GiB); misses the rare games that
reach an opening position later by a detour (23 of 5.9M for 1.e4) — documented;
- PGN position-table memory guard (`PgnDb::positions_blocked`), message on the search board;
- `chesspenguin --bench <db> [report.txt]`, dev hook `CP_MEMORY_LIMIT=<MB>`.
- Cache dir for all of it: `~/.cache/chesspenguin/boosters/<hash>.cbb|.cpo`.
Open: measure on a real laptop with `--bench` (4-thread taskset estimate: start 0.29 s with
the index vs 2.2 s without). Ask before pushing/releasing.
**Why:** opening positions match millions of games and no prefilter helps.
**How to apply:** keep results identical to the pass (tests compare them); document
measurements in docs/dev/import.md. See [[release-process]] before shipping.