Skip to content

IR is 4-8x the source: is a trimmed or sliced output mode wanted? #430

Description

@fuad-daoud

The measurement

Compiled from main, default compact output:

Spec source (compact) IR ratio types wall
Stripe (key-reordered, see the detection issue) 3.97 MB 32.04 MB 8.07x 15,787 2.5 s
GitHub 6.91 MB 46.85 MB 6.78x 12,804 3.8 s
petstore-expanded 5.5 KB 13.3 KB 2.43x - 17 ms

Compile time is not the issue — 3.8 s for a 13 MB document, parallelised at ~2.5x CPU. The size is.

The multiplier comes from per-node provenance (a source index plus a JSON pointer on nearly every field), explicit primitive and anonymous type nodes, and unmodeled payloads that duplicate source bytes.

Why it might matter

Provenance on every node is a real feature and this issue is not asking to remove it. But it means a whole-document IR is not something a consumer can hand to a browser, or hold two of in memory to compare, without thinking about it. A prospective consumer (spaceapi#56) diffs pairs of versions and precomputes every ordered pair, which at these sizes is not viable unchanged.

The question

Is there appetite for either of:

  • a provenance-trimmed output mode — same document, provenance omitted or reduced to a source index, for consumers that do not need to cite positions; or
  • a sliced read — fetch one operation or one type and its transitive type closure, rather than the whole document.

Both are consumer-side conveniences rather than IR semantics, so they may well be out of scope — worth asking before a consumer builds its own trimmer and gets the closure rules wrong.


Found by a study of dexpace/spaceapi adopting morphic IR as its input format (spaceapi#56), 2026-09-05. Related: #418 (non-emitter consumer), #419 (cross-revision identity).

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

    type:questionUsage question, not a defect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions