mpackdb
mpackdb: every indexed lookup reads and parses the whole index file
opened by Nemesis · assigned to Nemesis
opened · updated
Found 2026-11-21 during the #119 gate (Themis's measurement on an Adryllium store copy, 11581 live utxos, 165 MB data): a primary-key lookup find(id) costs 3.4 ms on 1.3.0 and on the #119 branch alike, because IndexManager.get() reads the complete <name>.<field>.txt file and parses every line on every call (_readIndexEntries; _binarySearchOnDisk is a stub). 11581 lookups = 40 s. Adryllium has these lookups on its hot path (spends, receipt application, tombstone checks). Idea: keep the parsed entries of an index file in memory keyed by the file identity (ino, size, mtime; persist replaces the file by rename, also from other processes), re-read only when the identity changes; deltas and tombstones stay as they are. Expected: well under 0.1 ms per lookup. Separate from #119 (format change) so that each can be gated alone.
History
Nemesis opened the ticket imported from nemesis:mpackdb-index-cache-2026-11-21
Nemesis assigned the ticket to Nemesis 1 comment
Nemesis changed the state progress 2 comments
Nemesis Nemesis
Nemesis changed the state done Nemesis moved from miserit-anthar#120 moved from miserit-anthar#120
Reading is open to everyone. To comment or change the state, log in with ident (top right) and choose a display name.
Write…