Skip to content

Add embedded text-size measurement scripts#252

Open
AaronWebster wants to merge 1 commit into
emboss/regenerate-goldensfrom
emboss/embedded-bench
Open

Add embedded text-size measurement scripts#252
AaronWebster wants to merge 1 commit into
emboss/regenerate-goldensfrom
emboss/embedded-bench

Conversation

@AaronWebster
Copy link
Copy Markdown
Collaborator

scripts/embedded_bench.sh cross-compiles a tiny driver TU that pulls LargeConditionalsView::Ok() and DisjunctionConditionalsView::Ok() into an object file, then reports size totals and per-symbol sizes on:

  • ARM Cortex-M4 Thumb-2 (arm-none-eabi-g++ -mthumb -mcpu=cortex-m4 -Os)
  • MicroBlaze big-endian (microblaze-buildroot-linux-gnu-g++ -Os)
  • Host x86-64 -Os as a reference

All builds use -ffunction-sections + -fdata-sections so each function gets its own section, making nm --size-sort and the object's total .text directly comparable across compiles.

scripts/embedded_compare.sh runs the bench on the current branch and a base ref (default master), forwarding the test schema and benchmark TU through the checkout so the comparison measures the generator output and not the test surface area. Prints a side-by-side table with absolute deltas and percentages.

Requires arm-none-eabi-g++ and a microblaze-* g++ on PATH or in /opt/microblaze. Builds on the regen script from #251.

No generator changes; no measurable impact on generated code.

scripts/embedded_bench.sh
  Cross-compiles a tiny driver TU that pulls LargeConditionals::Ok()
  and DisjunctionConditionals::Ok() into an object file, then reports
  the object's `size` totals and the per-Ok() symbol sizes on:
    * ARM Cortex-M4 Thumb-2 (arm-none-eabi-g++ -mthumb -mcpu=cortex-m4 -Os)
    * MicroBlaze big-endian (microblaze-buildroot-linux-gnu-g++ -Os)
    * Host x86-64 -Os as a reference
  All builds use -ffunction-sections + -fdata-sections so each
  function gets its own section, making `nm --size-sort` and the
  object's total .text directly comparable across compiles.

scripts/embedded_compare.sh
  Runs embedded_bench on the current branch and a base ref (default
  master), forwarding the test schema and the benchmark TU through
  the checkout so the comparison measures the generator output and
  not the test surface area. Prints a side-by-side table of TU .text
  and per-symbol sizes with absolute deltas and percentages. Builds
  on scripts/regenerate_goldens.py from the previous PR.

Depends on having arm-none-eabi-g++ and a microblaze-* g++ on PATH
(/opt/microblaze for the Bootlin-built MicroBlaze toolchain).
@AaronWebster AaronWebster requested a review from robrussell May 20, 2026 01:19
@AaronWebster AaronWebster marked this pull request as ready for review May 20, 2026 01:19
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