Repository navigation
HermitCrab analysis: measure required-slot look-ahead on the #546 shared walk #566
Description
PR #546 shares trailing slot batches across templates but only in untraced sequential walks, and it is unknown how much of its saving survives once required-slot look-ahead (#561) removes templates early. The trigger is any grammar with several templates sharing trailing slots and required markers (Mbugwe, Sena, Aweti). The cost of not measuring is landing two changes that overlap, or leaving shared-slot work uncounted.
Depends on #561 (required-slot look-ahead) and on PR #546. Nothing here can start until #561 reports a sound shadow result and #546 is merged or its branch is usable as a base.
Problem (census, steps)
Census: 92.8-96.9% of template-slot events on Aweti, Mbugwe and Sena are in rules shared by two or more templates. #546 removes the trailing-aligned part (C# batch counts: Mbugwe sample -19.3%, Sena sample -31.4%, from #546's own measurement). #546 is inert under tracing (AnalysisAffixTemplatesRule.Apply falls back to base.Apply when IsTracing), so it does nothing for Try-a-Word-style traced parses and the traced census does not see it.
Proposed change
Not a new prune: a measurement, plus a small hook if it pays. On the #546 walk (AnalysisAffixTemplatesRule.Walk), apply the look-ahead of #561 per trie node: skip a child when no template still admitted under it passes the look-ahead for its remaining required slots. Report the shared-slot work that #546 plus #561 leave (the residual).
Soundness
As #561, per template. The trie only reorders shared work; the remaining-slot set of a template at a trie node is its slots from that depth down to 0.
Memory bound
As #561 (grammar-sized, under 100 KB). Any further sharing of non-trailing slots needs a key on the shape, which is a memo and is closed by ledger row 29 and the owner rule, so the residual is reported as a ceiling only and not proposed.
Measurement plan
Needs one harness mode that sets IsTracing false only for the frame of AnalysisAffixTemplatesRule.Apply (the trick the census uses for merging), so the trie walk runs while slot-rule events are still counted. Four arms in census and censusmerge modes, same binary set: master; master + #561; master + #546; master + #546 + #561. Same grammars and sampling as #561, plus its stress fixture and a variant where 6 templates share their trailing 3 slots. Report slot events per arm and the residual after #546 + #561.
Kill criterion
If #561 saves under 3% of slot events on the #546 walk for every grammar where it saved over 5% on master, the two overlap and only one should land; report which. Expected value is uncertain until #561 reports.
Related
- HermitCrab analysis: skip template partials whose required slot material is absent #561, PR perf(hermitcrab): share trailing analysis template slot batches #546 (hard dependencies), PR Trace HermitCrab failure reasons and template slot outcomes #534 (trace nodes; relevant only because perf(hermitcrab): share trailing analysis template slot batches #546 is untraced-only).
- PR HermitCrab optimization round record: what was tried, and a faster package that is not mergeable #490: research record. PR Add a conformance suite for HermitCrab, with its adequacy argument #480: conformance suite; verdicts must be identical.
- Units: deterministic steps, never ms. Owner constraint: no memo or cache.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fields🆕 New
Activity