Skip to content

Conversation

dpgeorge
Copy link
Member

Summary

Add support to tools/metrics.py to compute the size delta of mpy-cross, alongside the sizes of port firmware. This is an easy and cheap addition because mpy-cross is usually built before the ports are.

Although the size of mpy-cross is not critical, it's still a nice indication of how the PR affects code size, and helps to eliminate any unwanted increases in mpy-cross.

Testing

Tested locally, eg the output looks like (for no change):

$ ./tools/metrics.py diff size0 size0
  mpy-cross:    +0 +0.000% 
   unix x64:    +0 +0.000% standard

CI will also test this, it should include mpy-cross in the automatic report.

Trade-offs and Alternatives

mpy-cross is already built as part of the code-size CI workflow, so we may as well report its size difference, along with port firmware size difference. It doesn't increase the time for the CI.

Signed-off-by: Damien George <damien@micropython.org>
@dpgeorge dpgeorge added the tools Relates to tools/ directory in source, or other tooling label Aug 29, 2025
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.38%. Comparing base (f0d445a) to head (4d27785).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #18006   +/-   ##
=======================================
  Coverage   98.38%   98.38%           
=======================================
  Files         171      171           
  Lines       22296    22296           
=======================================
  Hits        21937    21937           
  Misses        359      359           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Code size report:

   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge
Copy link
Member Author

OK, so the size diff for mpy-cross isn't in the above report because master doesn't have this patch. But you can see that it's working when building this PR:

COMPUTING SIZES
   text	   data	    bss	    dec	    hex	filename
 358771	  19576	    864	 379211	  5c94b	mpy-cross/build/mpy-cross
   text	   data	    bss	    dec	    hex	filename
  56308	      0	    392	  56700	   dd7c	ports/bare-arm/build/firmware.elf
   text	   data	    bss	    dec	    hex	filename
 150342	  11832	  26584	 188758	  2e156	ports/minimal/build/firmware.elf
   text	   data	    bss	    dec	    hex	filename
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tools Relates to tools/ directory in source, or other tooling
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant