Repository navigation
perf: decide net-assert on v8 index keys before building facts (#379) - #459
Merged
Merged
Conversation
Committed reads for a query are reduced to the records that survive net-assert while walking the index keys: the history of a triple is contiguous and newest first, so a transaction holding a retraction hides everything older (skipped, with a seek after a run of 8), and the first assertion per valid-time window wins. Only survivors are decoded and translated through the dictionary. :as-of N counter queries now take the same selective index path, passing over entries newer than N, instead of reading every fact in the file. The executor still applies net_asserted_facts to committed and pending facts together; prefiltering is exact because every pending fact is newer than every committed one and a record can only be hidden by a newer one. Randomized and differential (file vs in-memory) tests check this. point_query_chain_depth at depth 2000: churned attribute 4.61 -> 1.03 ms, attribute scan 5.87 -> 1.24 ms; :as-of point query 5.59 ms -> 23 us (depth 1). Design: docs/superpowers/specs/2026-10-06-live-key-scans-design.md Refs #379, #383 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
# Conflicts: # CLAUDE.md # README.md # ROADMAP.md # docs/TEST_COVERAGE.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #379, part of #383.
What
CommittedReader::live_facts(scan, as_of)— committed facts of a scan (all / entity / entity+attr / attribute) that survive net-assert atas_of. Default impl = history → filter →net_asserted_facts(reference).OnDiskReaderoverrides it with a key walk:tx↓, so entries are taken one tx group at a time; a group holding a retraction hides everything older in the triple; otherwise the first assertion per(vf, vt)window wins;seek(triple ‖ 0xFF)after 8 in a row (short histories pay no seek, long ones O(log));FactStorage::get_live_facts= pending (≤ as_of) + committed live. The executor uses it for(None, None)and:as-of Ncounter queries (selective and full scan).:as-oftimestamps and theWriteTransactionoverlay keep their path.get_facts_by_*) are now#[cfg(test)];LeafCursor::seekis used in production.Why exact: the executor still net-asserts committed ∪ pending. Every pending fact is newer than every committed one, and net-assert only lets a newer record hide an older one, so a committed record hidden among committed records stays hidden in the union, and a dropped committed retraction could only hide already-hidden older assertions. Spec:
docs/superpowers/specs/2026-10-06-live-key-scans-design.md.Perf (
point_query_chain_depth, checkpointed file; before =v3@74310ee):as-of 2002point (new bench row)Tests
1242 total (1233 passing, 9 ignored), +4:
triple_lenends exactly attx↓for every value type/index;:as-of;tests/live_reads_test.rs: same history in a checkpointed file DB vs in-memory → identical rows for point, attribute, full-scan, join, valid-time,:as-ofand rule queries, before and after reopen.cargo clippy --all-features -- -D warningsclean; wasm32--features browserbuilds.Note: touches
net_asserted_factssemantics only by reusing them; #435 (one window per triple) will need to change the key walk alongsidenet_asserted_facts.🤖 Generated with Claude Code
https://claude.ai/code/session_015GgLEs8YozJjYhwPEYgTUn