Skip to content

test(perf): measure compiler memory of typed queries - #220

Merged
piwi3910 merged 4 commits into
mainfrom
perf/compile-memory-guard
Nov 17, 2026
Merged

piwi3910 merged 4 commits into
mainfrom
perf/compile-memory-guard

Conversation

@piwi3910

Copy link
Copy Markdown
Contributor

What

Phase 1 of #217: measurement and a guard, no optimisation. A generator writes N models (run through the real momo generate) and a caller package of Q typed queries; a new compile-memory workflow compiles the caller package, records the Go compiler's peak RSS, profiles the compiler with a symbolised build, and fails above a budget.

Why

Packages that call momo's typed builders need 9-11 GB in the compiler (#217). There was no number in momo's CI and no symbolised profile.

How

  • internal/compilebench/gen: deterministic fixture generator (Select Row1..Row8, Where compositions, joins, aggregates, Update, Insert, Upsert, relation loads). Models vary in layout so they do not collapse into one generic shape.
  • internal/compilebench/nmreport: groups instantiated generic functions in go tool nm output by generic name, with counts and sizes.
  • scripts/compile-memory.sh and .github/workflows/compile-memory.yml: default, -l and -c=1 builds under /usr/bin/time -v; cmd/compile built from GOROOT and swapped in through -toolexec for the -memprofile build; pprof tables in the job summary; artifacts uploaded.
  • The budget is the single PEAK_RSS_BUDGET_KB env value in the workflow. Separate workflow, so a separate check that is not required.

Testing

Generator and nmreport unit tests run in CI. The measurement runs in the compile-memory check.

Notes for the reviewer

The first run uses a placeholder budget; it is set from the measured value plus headroom in a follow-up commit.

Checklist

  • PR title follows Conventional Commits
  • Tests added or updated
  • docs/ updated when behaviour changed (no behaviour change)
  • make test-race passes locally (CI only)

Adds a deterministic fixture generator (N models through momo generate plus a caller package of Q typed queries), a compile-memory workflow that records the Go compiler's peak RSS for the default, -l and -c=1 builds, a symbolised compiler memory profile, an instantiated-generics report from go tool nm, and a budget guard on the default peak. Refs #217.
@piwi3910
piwi3910 merged commit 5a1400c into main Nov 17, 2026
31 checks passed
@piwi3910
piwi3910 deleted the perf/compile-memory-guard branch November 17, 2026 08:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant