Cache recursive plans and bound page prefetch - #100
Draft
theronic wants to merge 2 commits into
Draft
Conversation
Owner
Author
|
Benchmark update after the page-sensitive recursive stream batching (DataScript browser, Explorer recursive 10k-server seed, 20-result page, 20 measured samples after warmup):
That is a 28.4% mean and 28.3% p50 uncached improvement. The full JVM, CLJS, generated-boundary, Dafny, and heavy pagination suites remain green; exact counts are in the PR description. |
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.
What changed
Root cause
Recursive queries reused schema path and routing classification caches, but rebuilt traversal rules, forward-consumer indexes, and reverse rule indexes on every cache miss or cache-disabled request. That repeated work depends only on immutable schema, not graph data or the principal.
Separately, every recursive graph stream prefetched 64 datoms even for a 20-result UI page. The engine consumed only 93 datoms for the Explorer page but could realize substantially more backend data. Page-sensitive batches preserve 64-datom amortization for large scans while removing most small-page over-read.
Safety boundary
A plan is keyed inside a backend/source/schema-proof generation. It contains only schema-derived rules and indexes. Authorization answers and request-local traversal state are never shared. Raw or arbitrary DB evaluation without a trusted schema proof still compiles per request.
The formal release gate intentionally remains withheld: the complete public Clojure/CLJS engine is not generated from the proof kernel.
SchemaPlanCost.dfyproves deterministic operation-count properties and is paired with runtime counters; it does not claim wall-clock verification or full-engine refinement.Performance
DataScript browser benchmark on the Explorer recursive 10k-server seed, 20-result page, 20 samples after warmup:
The schema-plan cache is a safe cross-principal compilation network effect. The measured small-page gain comes primarily from bounded prefetch. Large page scans retain the 64-datom batch.
Validation
SchemaPlanCost.dfyhas 14 verified obligationsExplorer consumer: theronic/eacl-explorer#3