Local search index: up to ~80 MB in memory, and rewritten on every post once full #232
Labels
No labels
area/ci
area/desktop
area/packaging
area/protocol
area/reading
area/ui
area/web
area/writing
kind/bug
kind/feature
kind/infra
kind/request
needs/user
parked
perf
security
upstream
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
littlefox/neokom#232
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found in the codebase review (#230, D-058). Relevant to the big-meeting reports (#227, #228).
kom_client::searchkeeps up toCAP = 20_000posts with up toBODY_CHARS = 4000characters of body each, all in memory inINDEX(app/src/search_view.rs). Full, that is up to ~80 MB of strings.Index::searchbuildsformat!("{subject}\n{author}\n{conf}\n{body}").to_lowercase()for each of the 20 000 entries. That allocates and lowercases up to ~80 MB per query.search_view::noteruns for every post shown or previewed, so each new post drops the oldest. A drop makessearch_store::saveread the whole index file, filter it and write it back, synchronously on the UI thread. Reading through a big meeting with a full index rewrites tens of MB for every card.noteruns a newdocument::evalthat opens the IndexedDB database again and runs its own transaction, once per post. A thread with 100 cards gives 100 evals and 100 opens.getAll→ JSON →Vec<String>) and parsed before search works.Directions:
Measure with #225: memory at a full index, and the time of a search and of a card shown.
Merged in #267; main run #447 green. Verified: search and mentions specs on three profiles, incl. the index kept after a reload; unit tests incl. dropping a thousand at once;
tools/perf.sh: hits 25 → 16 ms on a ~700-post index.