Skip to content

HermitCrab analysis: keep equivalent-analysis merging on while tracing #565

Open

Description

@johnml1135

HermitCrab turns off equivalent-analysis merging while tracing, so a traced parse repeats lookups that an untraced parse folds. The trigger is any traced parse (Try-a-Word style): analyses reaching lexical lookup rise by 1.67x on Mbugwe and 2.19x on Aweti. In steps the effect is small, so expected value is low.

Problem (census, steps)

AnalysisStratumRule skips merging when tracing ("Don't merge if tracing because it messes up the tracing"). Census, traced unmerged versus merged: analyses reaching lookup Mbugwe 9,334 to 15,617 (x1.67), Aweti x2.19. Analysis event totals move by only -0.2% to 2.4%, because most of the extra work is lookup-side and lookups are 0.7% of Mbugwe events. The synthesis-side effect is unverified (the census says synthesis steps are unchanged, which is hard to reconcile with lookup-driven synthesis; it needs rechecking before any claim).

Proposed change

Keep merging on while tracing and record folded duplicates as one node with a count. This is a product decision on how Try-a-Word shows folded duplicates, not only an optimization.

Soundness

Merging is already used untraced and is parse-identical there (ledger rows 4, 5, 16 family; PR #493). The open soundness question is the trace: callbacks for a merged duplicate are skipped, so LexicalLookupCompleted counts and trace-node counts change meaning, which affects PR #534's reported counts.

Memory bound

One count field per folded trace node. No cache.

Expected value (low, possibly negative)

Analysis events change by only 0.2 to 2.4% (the plan lists it as -0.2..2.4%, so the sign is uncertain); lookups divided by 1.67 (Mbugwe) to 2.19 (Aweti) under tracing. Memory gain probably modest (lookups are 0.7% of Mbugwe events), unmeasured.

Measurement plan

Census harness: censusmerge mode versus census mode on all grammars, report events, lookups and synthesis steps separately; first reconcile the synthesis-steps claim.

Kill criterion

Close if the synthesis-step reconciliation shows no reduction, or if the product owner of Try-a-Word does not want folded duplicates in the trace.

Dependencies

None. Interacts with PR #534 (trace nodes) and T1 (trace memory).

Related

🤖 Generated with Claude Code

Activity

  1. jtmaxwell3 commented on Oct 27, 2026

    @jtmaxwell3
    Collaborator

    In FieldWorks, we might be able to add a button where a trace is merged to jump to the trace that it was merged into. The rest of the trace would show up as an alternative at the corresponding point in synthesis. We could allow the user to specify whether they wanted traces merged or not, since it makes debugging more complicated for simple words but may be necessary for performance reasons for complicated words.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    • Status
      🆕 New

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions