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. |
||
|---|---|---|
| .. | ||
| api | ||
| benchmarks | ||
| comprehensive | ||
| configs | ||
| fixtures/import | ||
| helpers | ||
| integration | ||
| integrations | ||
| performance | ||
| regression | ||
| scripts | ||
| transaction | ||
| unit | ||
| vfs | ||
| brainy-3.test.ts | ||
| critical-error-handling.test.ts | ||
| critical-neural-validation.test.ts | ||
| critical-performance-benchmark.test.ts | ||
| model-loading.test.ts | ||
| package-size-breakdown.test.ts | ||
| package-size-limit.test.ts | ||
| setup-integration.ts | ||
| setup-semantic.ts | ||
| setup-unit.ts | ||
| setup.ts | ||
| streaming-pipeline.test.ts | ||
| type-utils.test.ts | ||