Skip to content

add mitata harness for precompile (parse/normalize/precompile)#21316

Merged
NullVoxPopuli merged 1 commit intoemberjs:mainfrom
johanrd:bench/glimmer-syntax
Apr 16, 2026
Merged

add mitata harness for precompile (parse/normalize/precompile)#21316
NullVoxPopuli merged 1 commit intoemberjs:mainfrom
johanrd:bench/glimmer-syntax

Conversation

@johanrd
Copy link
Copy Markdown
Contributor

@johanrd johanrd commented Apr 16, 2026

Summary

Split out from #21314 so reviewers can run the bench on main and on any perf branch independently.

Adds a reproducible mitata harness for the template compile pipeline:

  • parsepreprocess (HBS → ASTv1, @glimmer/syntax)
  • normalizenormalize(new src.Source(src)) (ASTv1 → ASTv2, @glimmer/syntax, loc-conversion hot path)
  • precompile — full ember-template-compiler entry (all phases + ember AST plugins)

Three fixture sizes — small (~1.5k chars), medium (small × 3), large (small × 22, ~33k chars, scale of the largest real route templates, e.g. Discourse's admin-user/index.gjs).

Run:

pnpm build
pnpm bench:precompile

To compare branches, check out each branch, build, run the bench, and diff the ms/iter numbers. Emits mitata's standard ms/iter + boxplot + summary output.

Scope

  • bin/precompile.bench.mjs — new bench harness (83 lines), sibling to existing bin/benchmark.mjs
  • package.json — adds bench:precompile script and mitata devDependency
  • pnpm-lock.yaml — lockfile update for mitata

No runtime or library code changes. Public-API-only — works on any branch.

Test plan

  • pnpm install && pnpm build && pnpm bench:precompile runs to completion on main
  • Same on any feature branch under review — diff ms/iter to measure impact

@johanrd johanrd changed the title bench: add mitata harness for @glimmer/syntax parse/normalize/precompile temporary for comparison: add mitata harness for @glimmer/syntax parse/normalize/precompile Apr 16, 2026
@johanrd johanrd marked this pull request as draft April 16, 2026 13:18
@NullVoxPopuli
Copy link
Copy Markdown
Contributor

this is not temporary! we'll use this a lot with changes to the parser

@johanrd johanrd changed the title temporary for comparison: add mitata harness for @glimmer/syntax parse/normalize/precompile add mitata harness for @glimmer/syntax parse/normalize/precompile Apr 16, 2026
@johanrd
Copy link
Copy Markdown
Contributor Author

johanrd commented Apr 16, 2026

@NullVoxPopuli ok, makes sense.

In that regard – I was questioning wether to add it in the smoke-test dir instead?

@johanrd johanrd marked this pull request as ready for review April 16, 2026 16:30
@NullVoxPopuli
Copy link
Copy Markdown
Contributor

it should probably be in the bin directory I think?

@johanrd johanrd force-pushed the bench/glimmer-syntax branch from 4737760 to 8147e49 Compare April 16, 2026 18:10
@johanrd
Copy link
Copy Markdown
Contributor Author

johanrd commented Apr 16, 2026

ok, yes, did that now. also renamed to bin/precompile.bench.mjs

@johanrd johanrd changed the title add mitata harness for @glimmer/syntax parse/normalize/precompile bench: add mitata harness for precompile (parse/normalize/precompile) Apr 16, 2026
@johanrd johanrd changed the title bench: add mitata harness for precompile (parse/normalize/precompile) add mitata harness for precompile (parse/normalize/precompile) Apr 16, 2026
Reproducible benchmark for the template compile pipeline. Runs three
phases at three fixture sizes:

  - parse      (preprocess, HBS → ASTv1 — @glimmer/syntax)
  - normalize  (ASTv1 → ASTv2 — @glimmer/syntax, loc-conversion hot path)
  - precompile (full ember-template-compiler entry, all phases + plugins)

Sizes: small (~1.5k chars), medium (small × 3), large (small × 22,
~33k chars — scale of the largest real route templates, e.g. Discourse's
admin-user/index.gjs).

Run:

  pnpm build
  pnpm bench:precompile

To compare branches, check out each branch, build, run the bench, and
diff the ms/iter numbers. Emits mitata's standard ms/iter + boxplot +
summary output.
@johanrd johanrd force-pushed the bench/glimmer-syntax branch from 8147e49 to 47e2535 Compare April 16, 2026 18:15
Copy link
Copy Markdown
Contributor

@NullVoxPopuli NullVoxPopuli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

beautiful, thank you <3

@NullVoxPopuli NullVoxPopuli merged commit 8eda63c into emberjs:main Apr 16, 2026
38 checks passed
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.

2 participants