Repository navigation
ci: Integrate membrowse. - #18558
ci: Integrate membrowse.#18558michael-membrowse wants to merge 1 commit into
Conversation
292f6d0 to
ab19725
Compare
|
Code size report: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #18558 +/- ##
=======================================
Coverage 98.46% 98.46%
=======================================
Files 176 176
Lines 22811 22811
=======================================
Hits 22460 22460
Misses 351 351 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ab19725 to
ca774ce
Compare
There was a problem hiding this comment.
This seems a very useful thing to add to MicroPython's CI.
To test, I've merged this set of changes into my own fork:
Then performed the other steps described to set up and link to a membrowse project; then ran the Membrowse onboard action to analyze (for expediency) the 10 most recent commits.
To look at what the steady-state behavior then is, I created a PR against my fork for a particular set of changes I've been working on but struggling to attribute size changes on:
Once the CI jobs completed, this generated the following comment:

Note, that the examined targets are not identical between code-size vs membrowse, e.g. pybv10 vs pybv11, and the missing unix, minimal-arm, and mpy-cross targets. If the two were to disagree though, I'd actually already be more inclined to believe membrowse: the file-size-based estimate used by code-size could be fooled even just by padding changes to the firmware's ELF/UF2/etc container.
Following through to the symbol analysis tab for stm32-pybv11 shows a change I'd think reasonable to expect for the commits in question:

Following through to the symbol analysis tab for qemu-virt-rv32 shows a different change, possibly a bookkeeping or inlining change associated with the realloc calls in the lists implementation:

MicroPython's current home-grown code-size tool has been a useful part of keeping MicroPython slim, but it doesn't provide granular information nearly this useful; this also fixes many of the frustrations I've had at times trying to hunt down linker padding feng-shui ghosts.
If it's possible to add in membrowse targets for unix, minimal-arm, and mpy-cross (as covered by code-size), I could even see eventually superceding and removing code-size once this project has gained enough familiarity with membrowse.
For now, though, and even if those targets can be added, it feels wise to also continue to run code-size alongside membrowse, since there's other cases for code-size (like all the offline runs everyone does via their own custom scripts). Either way, though, this feels like a substantial upgrade for the main CI use-case.
fd64bc2 to
cfb15a5
Compare
|
As @AJMansfield requested i've added the |
cfb15a5 to
056faf3
Compare
| "ld": "ports/minimal/stm32f405.ld" | ||
| }, | ||
| { | ||
| "target_name": "unix-x64", |
There was a problem hiding this comment.
I think the name should be unix-standard to keep to the - notation
| "linker_vars": "flash_start=0x60000000 flash_size=0x200000 vfs_start=0x60100000 vfs_size=0x100000 reserved_size=0" | ||
| }, | ||
| { | ||
| "target_name": "rp2-pico-w", |
There was a problem hiding this comment.
I think rp2-pico-w is actually correct here - rp2 matches the port directory (ports/rp2) and follows the same {port}-{board} pattern as the other targets.
|
I have been using membrowse in my own fork to track the impact of changes across ports, and I have found it very insightful and simple to use, especially though the portal. |
|
@Josverl Thanks for your comment. You can set your projects to be accessed without authentication. You need to go to the project settings in the MemBrowse portal and set the project as publicly available. |
056faf3 to
028ef89
Compare
projectgus
left a comment
There was a problem hiding this comment.
Hi @membrowse,
Thanks for submitting this PR, and for offering membrowse for free to open source projects! This is a really nice interface for looking at size changes.
It looks like we could replace our current code_size job with this one and gain a bunch of nice features, the only downside I see from our perspective would be if Membrowse goes away (hopefully not) - but we can always bring back the old code_size in this case.
From clicking around the sample I do have one feature request (not a dealbreaker for this PR) - when comparing two commits then it'd be really nice to be able to switch targets without losing context (i.e. make the "target" in the top left a dropdown instead of a label). IIUC currently to look at the same diff for a different target I have to click on Project, click on the new target, and then I have to manually select the same commit(s) again. This is often the most time-intensive part of analysing diffs with our current systems (where the same code diff yields quite different code size changes on different targets, and you're trying to drill down into what exactly is different between the targets).
Thanks again!
|
@projectgus Thank you for your feedback and the feature suggestion. |
44222e7 to
028ef89
Compare
|
@projectgus I've implemented your feature suggestion. |
|
@michael-membrowse That's really handy, thank you! |
f58f6d0 to
7c272b2
Compare
Signed-off-by: Michael Rogov Papernov <[email protected]>
7c272b2 to
7476de4
Compare
|
Updated the pull request with simplification of the PR comment workflow |
Summary
MicroPython has a code-size workflow but no automated way to track how PRs affect memory footprint over time or compare against previous commits.
This PR adds MemBrowse CI integration for automated memory footprint analysis on pull requests.
It creates a PR comment with the size changes on region and section level with links to the full build comparison page.
It was discussed with @AJMansfield on Discord, who suggested opening a PR.
Here is an example of the dashboard and its features: https://membrowse.com/public/membrowse/micropython
This includes:
Setup for maintainers:
Run the onboard workflow to populate the dashboard with historical data.
Testing
End-to-end validation performed on a personal fork
Trade-offs and Alternatives
External dependency.
Maintenance
As the author of MemBrowse, I'm committed to maintaining this integration and ensuring it continues to work correctly.
If issues arise, feel free to ping me on Micropython's discord or or at [email protected].
Happy to adjust boards, scope, naming, or workflow triggers based on feedback.