Hi all,

While working on size patches I kept wanting to compare two local
builds without leaving the terminal. MemBrowse covers CI, and
tools/showsize.sh looks at one binary, but I couldn't find something in
tools/ that compares two ELFs on any config. So I wrote tools/bloat.py:
Python standard library only, wrapping the toolchain's size and nm,
with unit tests in tools/test_bloat.py and a docs page.

Code: https://github.com/Swatantra-66/nuttx/tree/feature/bloat-tool

Example on stm32f103-minimum:nsh (arm-none-eabi-gcc 14.2.1), commit
10998bb416 vs 5d150b4109, which makes CONFIG_FS_IOCTL_FILEPATH optional:

$ python3 tools/bloat.py -p arm-none-eabi- -A -n old.elf new.elf

Section totals (Old -> New, Delta):
text   53476 -> 53236  (-240)
data     340 ->   340  (+0)
bss     3144 ->  3144  (+0)
Flash  53816 -> 53576  (-240)
RAM     3484 ->  3484  (+0)

Changed: file_vioctl 412 -> 316 (-96)
Removed: inode_getpath (-76), strlcat (-72)

(output trimmed; the flash delta matches the linker's own flash-used
figures for the two builds.)

I used AI to help draft the code. I reviewed it, ran the tests and did
the comparison above myself. I didn't copy from Linux's bloat-o-meter
(GPL).

1. Does an equivalent exist or is one in progress?
2. Is tools/ the right place, and are test files there fine?
3. Any objection to me sending a PR?

Thanks,
Swatantra

Reply via email to