HermitCrab analysis: one-template battery is 45% of work on a private grammar; FST-derived precheck ceiling unmeasured

Ouverte
#604 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
38/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
Active
Stack technique
csharp
Domaine
performance

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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)
Langage dominant
C#
Étoiles
29
Forks
16
Merge moyen
4 j 11 h
PR mergées (30 j)
14

Préparer son environnement

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de sillsdev/machine

Toutes les issues de sillsdev/machine

Issues similaires

Plus d'issues C#

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.