host plan executor - #99
Draft
Nic-Polumeyv wants to merge 14 commits into
Draft
Conversation
…a checkpoint, plain covers read slots, occurrences dense
… text scanned by byte
…, scope tables without hashing, one remap pass
…r, field output inline
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.
Before this, a host described its template syntax in a small language of our own and a walker in Rust filled the gaps with special cases: which attribute meant a shadow root, where a
let:binding was visible, which branch of a choice to take from its first token, which scope a name belonged to from field order. Every new syntax added a keyword, and the parser quietly knew Svelte.Now the host hands over a plan built from four things that compose and nothing else: rules that build records, forms that say what to read in order, regions that say which scope covers which fields, and one declare. Rust validates it at load and this executor runs it. Choices that can be told apart by their first token dispatch directly; the rest back out cleanly. Scopes come from what the plan states, not from position. The old grammar reader and both
.grammarfiles are gone.Why it is better: a new framework writes a plan and gets what Svelte gets, with no change to the parser; the concepts are few enough to learn once; and the cases the old walker guessed wrong are now right by construction (
<Comp let:x p={x}>, Vue'sv-forsource andv-slotprops). Svelte's suite passes on it at parity.One public change to state: the JSON and CLI entry no longer detects TypeScript from
<script lang="ts">; the caller says which dialect a document is, as the plan model requires. Svelte's phase 1 does that in stage E.Draft until the host benchmark is within 10% of main. Where it stands, pins byte-identical throughout: 200 each blocks, main 490 µs, this branch 820 µs (from 2,769 µs at the first executor); a 6.8 KB real component, main 150 to 244 µs across runs, this branch 260 µs. Allocations are at zero per node. What is left is the executor's per-record cost (about 1,800 records for that document, 165 ns each of form execution and 160 ns per region), spread over form dispatch, region resolution and the header pre-scan, with nothing dominant; the next step is specializing region evaluation and flattening forms into an instruction array.