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. |
||
|---|---|---|
| .. | ||
| aggregation | ||
| brainy | ||
| db | ||
| graph | ||
| hnsw | ||
| import | ||
| indexes/columnStore | ||
| neural | ||
| performance | ||
| storage | ||
| transaction | ||
| types | ||
| universal | ||
| utils | ||
| vfs | ||
| boundary-no-native.test.ts | ||
| brainy-core.unit.test.ts | ||
| brainy-get-optimization.test.ts | ||
| create-entities-default.test.ts | ||
| fieldTypeInference.test.ts | ||
| plugin-version-coupling.test.ts | ||
| plugin.test.ts | ||
| type-filtering.unit.test.ts | ||
| vfs-multi-instance-diagnostic.test.ts | ||
| vfs-restart-fix.test.ts | ||