
60% less flash, 46% less RAM on the same ATmega328P menu code — just by changing the composition engine underneath
Been working on a compile-time composition framework (HAPI) for C++17 — built with embedded in mind. Just confirmed the first real hardware validation of an AM4-to-OneMenu compat layer, on an ATmega328P/Uno via an existing port (Fielduino):
| Flash | RAM | |
|---|---|---|
| AM4 original | 15,958 B (49.5%) | 593 B (29.0%) |
| OneMenu/HAPI compat port | 6,384 B (19.8%) | 322 B (15.7%) |
| Delta | 60.0% less | 45.7% less |
Same unmodified driver, same menu shape, same Serial I/O — the only thing that changed is the composition engine underneath. No vtables, no dynamic allocation, no heap fragmentation — composition resolves entirely at compile time.
Also validated across CH32V003, ESP32, ESP8266, native Linux, SAMD, and STM32 (F030/F103/F407) — same header-only C++17 code, no per-target rewrites needed.
Compile-time composition example (check the generated assembly): https://godbolt.org/z/6srTzdTY7
u/neurah — 8 hours ago