brainy/tests/unit/db
David Snelling ceed70d7be perf(8.0): per-id history chains for O(log) historical reads + bounded delta cache
Historical reads (asOf/get) scanned the global committedGens list linearly,
making them O(database-age): a read of an unchanged entity at an old pin scaled
~12x for 10x history depth. Add per-id inverted history chains (nounChains/
verbChains) so resolveAt binary-searches the id's own generation chain instead —
O(log) and flat with depth. Chains build lazily under the commit mutex,
maintain incrementally on commit, and invalidate on compaction.

Also bound deltaCache (LRU cap 4096; getDelta re-reads evicted deltas) so a
long-lived high-write process's heap is O(cap) not O(generations) on the
disk-backed path, and binary-search commitTimestampAtOrBefore (O(log)).

Verified: 373 unit tests green; new tests/unit/db/generation-chain.test.ts
covers chain resolution, eviction re-read, and chain rebuild after compaction.
2026-06-22 13:47:33 -07:00
..
db-portable-graph.test.ts feat(8.0): API simplification — remove neural()/Db.search, one storage path key, integration→0 2026-06-20 13:31:11 -07:00
generation-chain.test.ts perf(8.0): per-id history chains for O(log) historical reads + bounded delta cache 2026-06-22 13:47:33 -07:00
generationStore.test.ts feat(8.0): generational MVCC storage + Datomic-style Db API (now/transact/asOf/with/persist) 2026-06-10 14:14:07 -07:00
stableEqual.test.ts feat(8.0): temporal range verbs — diff, history, since(gen|Date), asOf{exclusive}, transactionLog window 2026-06-19 13:21:02 -07:00
whereMatcher.test.ts feat(8.0): generational MVCC storage + Datomic-style Db API (now/transact/asOf/with/persist) 2026-06-10 14:14:07 -07:00