HermitCrab analysis: one-template battery is 45% of work on a private grammar; FST-derived precheck ceiling unmeasured
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 38/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- csharp
- 領域
- performance
研究方向
Start with docs/hermitcrab-2026-10-21-search-cost-round.md, lines 319–330, on the docs/hc-optimization-ledger branch. Instrument zero-match traversal work in steps on single-template grammars and measure its share of parser work; the issue says to build a precheck only if that share is material.
由索引模型根據 Issue 內容生成。
描述
Claude-drafted.
On a one-template grammar the template battery is 45% of parser work (a private grammar variant, v1, held list; HC-Rust work steps, before change C), and the shipped shared-slot-batch change cannot help it. An FST-derived precheck could reject slot rules before traversal, but its ceiling is not measured.
Status: open research lead, not built.
What we know (HC-Rust port, work steps; the lead is tagged as having a C# analogue):
- Battery share of parser work before change C: v1 held 45%, Mbugwe 61%, Sena 23%, Amharic 21%, private base 8%, private deletion variant 6.5%, Indonesian 0 (no templates).
- Sharing trailing slot batches (change C, ported as #546) saves 0 work on Amharic and every private variant (one template each) and on Indonesian (no templates), so there is nothing to share.
- After fix A, v1's held list still costs 105.8M work units, 45% of it in the one-template battery.
- The nearest shipped check is the edge-segment prefilter (ledger row 22). It tests only a rule's first and last segments and was judged on traversals. This lead derives its condition from the whole compiled matcher and is judged in work steps, since a traversal charges per arc.
Not known: the ceiling, meaning the work spent in zero-match traversals on single-template grammars.
Proposed change: instrument zero-match traversal work in steps on single-template grammars first. Build the precheck only if that share is material.
Related: #564 (open), #574 (PR, open), #599 (open), #546 (PR, open). PanGloss: sillsdev/PanGloss#106 (pointer, open). The required-slot look-ahead in sillsdev/PanGloss#25 and #66 is a different mechanism (state not checked).
Next: add a zero-match traversal work counter and report it per single-template grammar.
Evidence -- battery share by grammar
Battery share of all parser work, HC-Rust, before change C (L191-L201 (lines 191–201)):
| Grammar | Battery share |
|---|---|
| Mbugwe | 61% |
| Private v1, held | 45% |
| Sena | 23% |
| Amharic | 21% |
| Private base | 8% |
| Private, loaded from C#'s export | 9% |
| Private deletion variant | 6.5% |
| Indonesian | 0 |
Change C's static census found no sharing possible on Amharic (50 to 50) and the private project (30 to 30), one template each (L204-L207 (lines 204–207)). Change C measured 0 on the grammars with one template (L222-L223 (lines 222–223)).
Sources -- pinned to 2eba2f50 (closed PR #490 record)
- Open lead 1: search-cost round L325-L331 (lines 325–331); v1 held cost: L315-L317 (lines 315–317).
- Table row: ledger row 22, L113 (line 113); mechanism: docs/optimizations/edge-segment-prefilter.md.
- Verdict row for the FST-derived precheck: L303 (line 303).
- 主要語言
- C#
- 星號
- 29
- 分支
- 16
- 平均合併
- 4 天 11 小時
- 30 天內合併 PR
- 14
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 沒有貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
sillsdev/machine 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
HermitCrab: one partial rule switches off the final-template prune for the whole grammar; Mbugwe chaanjiyɛ never finishes可能已有人在做 @johnml1135 今天認領。 未關閉
難度 5/5 一週以上 新手友好度 25/100
維護者通常 1 天內回覆
-
Hermit Crab performance
難度 5/5 一週以上 新手友好度 35/100
維護者通常 1 天內回覆
-
Hermit Crab performance
難度 5/5 一週以上 新手友好度 25/100
維護者通常 1 天內回覆
相似的 Issue
-
bug emitter:client:csharp
難度 2/5 1-3 小時 新手友好度 84/100
microsoft/typespec#12572 · 1 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
-
needs-area-label
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 2 天內回覆
-
AWS Lambda: KeyNotFoundException drops HTTP-triggered transactions when allowAllHeaders is disabled未關閉bug
難度 2/5 1-3 小時 新手友好度 70/100
newrelic/newrelic-dotnet-agent#3949 · 1 則留言 ·
維護者通常 1 天內回覆
-
area-networking
難度 2/5 1-3 小時 新手友好度 78/100
dotnet/aspnetcore#70545 · 1 則留言 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 87/100
維護者通常 1 天內回覆