Skip to content

perf(extraction): stop the Metal adapter from activating the large grammar bundle #1061

Description

@ScriptedAlchemy

Priority: P2 selective-build footprint. Not a release blocker or a claim of measured executable savings.

Evidence at #707 3d955ff998eef120cd398f163c613a54e3383ccb

Consequently, adding Metal to a lite build activates a large unrelated grammar dependency even though the adapter uses the same C++ extraction path. A full build already selects that bundle for other languages, so this is specifically an avoidable selective-build cost; do not claim a default/full release reduction from this feature-edge change alone.

Smallest change

Make lang-metal depend on the actual C++ grammar provider rather than large-grammars (the existing medium-grammars boundary is the immediate candidate). Keep .metal dispatch and retained-tree behavior. Do not introduce a new Metal parser, a grammar registry framework, a dependency fork or another capability matrix for this alias.

Verify the exact C++ grammar identity/output being selected before making the change. With both bundles enabled, the later table entries can replace an earlier same-key entry; do not assume the two upstream bundle snapshots have byte-identical C++ parsers without checking. If they differ, preserve the intended supported C++/Metal behavior explicitly and separate any grammar upgrade from this packaging cut. Do not silently exchange syntax behavior to obtain a smaller dependency graph.

Acceptance

  • A fresh --no-default-features --features lite,lang-metal extraction build no longer resolves/compiles the large grammar bundle solely for Metal.
  • A narrow --no-default-features --features lang-metal build has the parser its registered adapter needs and can extract a real Metal fixture.
  • Full and retained/incremental extraction preserve canonical nodes, spans, relations and refusals on the existing Metal/C++ regression corpus. This proves the actual adapter boundary, not a hard-coded inventory of every Cargo feature edge.
  • Report resolved grammar dependencies, native archive/rlib bytes, clean build time and stripped binary size separately where measured. Linker dead stripping and duplicate grammar copies must be measured rather than guessed.
  • Ordinary full-feature languages remain available; the patched Rust grammar and dedicated Markdown binding are unchanged.

Related

#978's main Markdown/lite problem is already fixed and closed; its closure reports actual reductions. This is a separate unnecessary dependency edge exposed after that cut, not a request to reopen #978 or restore the old duplicated cfg inventories. #1053 owns the vendor review split and #1054 WGSL provenance/build invalidation. Keep #707 draft. Source inspection only; no Cargo builds, parser tests or size benchmarks were executed for this issue.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions