[api] Remove noinline from encode_fixed32

Profiling showed the noinline call overhead dominated hot paths like
SensorStateResponse encoding, where encode_fixed32 is called twice
per message (once for key, once via encode_float for state).

The function body is trivial (tag byte + 4-byte memcpy), so the
function call prologue/epilogue cost exceeded the actual work.

Despite 51 call sites, removing noinline shows no measurable flash
size increase (555167 bytes before and after on ESP32).
This commit is contained in:
J. Nick Koston
2026-03-20 23:07:12 -10:00
parent d203a46ef8
commit 21929eb157
+1 -2
View File
@@ -276,8 +276,7 @@ class ProtoWriteBuffer {
this->debug_check_bounds_(1);
*this->pos_++ = value ? 0x01 : 0x00;
}
// noinline: 51 call sites; inlining causes net code growth vs a single out-of-line copy
__attribute__((noinline)) void encode_fixed32(uint32_t field_id, uint32_t value, bool force = false) {
void encode_fixed32(uint32_t field_id, uint32_t value, bool force = false) {
if (value == 0 && !force)
return;