Repository navigation
docs(footprint): make the per-TU wrapper table reproducible, and re-measure it - #186
Merged
Merged
Conversation
…easure it The "C++ wrapper on bare metal" table reported 338 / 834 / 884 / 1034 B of ARMv6-m .text for a consumer translation unit. Those numbers came from an ad-hoc TU that was never committed -- #162 measured "the same consumer TU" and the file did not survive the commit -- so the table could not be reproduced, re-derived or checked for drift. Every other footprint figure in the README regenerates from tools/footprint.sh; this one did not regenerate from anything. Commit the measured TUs and the script that reads them: test/footprint-tu/consumer.c the message through the C API test/footprint-tu/consumer.cpp the same message through the wrapper tools/footprint-tu.sh compiles each alone, reports `size` Both encode and decode the same message -- five scalar fields, a nested sequence holding two scalars, one string -- so the C row and the wrapper rows are comparable, which is the whole point of putting them in one table. consumer.cpp reaches only for the heap-free surface, which exists in both wrapper modes, so the freestanding/hosted delta is what the header gates rather than what the TU asked for. Both round-trip correctly when linked against the library (verified hosted), so the table measures a working consumer and not a compile-only shell. Measured, ARMv6-m, -Os, with this project's own Release and toolchain flags: C API directly 440 B C++ wrapper, freestanding 962 B (+522 B) C++ wrapper, hosted 1180 B (+740 B) C++ wrapper, hosted, RTTI on 1447 B (+1007 B) These REPLACE the old figures rather than correct them: the original TU is unrecoverable, so the difference is a different fixture, not measured drift, and the two sets are not comparable. What is reproducible from here on is this one. The C core is untouched; no library row moves. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every footprint figure in the README regenerates from
tools/footprint.sh— except one. The "C++ wrapper on bare metal" table reported 338 / 834 / 884 / 1034 B of ARMv6-m.textfor a consumer translation unit, measured on an ad-hoc TU that was never committed (#162 measured "the same consumer TU" and the file did not survive the commit). That table could not be reproduced, re-derived, or checked for drift.What this adds
test/footprint-tu/consumer.ctest/footprint-tu/consumer.cpptools/footprint-tu.sh-c), reportssizeon the objectBoth encode and decode the same message — five scalar fields, a nested sequence holding two scalars, one string — which is what makes the C row and the wrapper rows belong in one table.
consumer.cppreaches only for the heap-free surface, present in both wrapper modes, so the freestanding→hosted delta is what the header gates, not what the TU asked for.Nothing is linked, so library calls stay external references and only the TU's own code is counted. Flags mirror a real build: the Release flags from the top-level
CMakeLists.txtplus the Cortex-M toolchain flags.Measured (ARMv6-m,
-Os).textA freestanding MCU consumer pays 962 B per TU, not 1447.
These replace the old figures rather than correct them
The original TU is unrecoverable, so the difference between 834 B and 962 B is a different fixture, not measured drift — the two sets are not comparable and the old ones cannot be validated. What is reproducible from here on is this one. That is stated plainly in the commit message so nobody later reads the change as a regression.
Verification
-Wall -Wextra -Wpedantic -Werror.One open question for you
Nothing in CI compiles these two fixtures.
tools/footprint-tu.shbuilds them with-Werror, so running it is the guard — but this repo's own lesson from #162 was "nothing caught it because nothing ever built it", and an uncompiled fixture is how that repeats.test/cpp-freestanding/is the existing precedent for a compile-only guard target. Say the word and I will wiretest/footprint-tu/up the same way.🤖 Generated with Claude Code