mirror of
https://github.com/esphome/esphome.git
synced 2026-09-18 02:28:42 +00:00
Revert force-inlining of calc_uint32 and calc_length
The ESPHOME_ALWAYS_INLINE on these caused significant flash bloat in cold calculate_size() callers (DeviceInfoResponse +117B, HelloResponse +63B, ListEntitiesEventResponse +79B) while only benefiting the BLE hot path marginally. Let the compiler decide when to inline these. The varint() fast path remains force-inlined as that eliminates the most expensive indirect calls on the hot path. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
05896c38e8
commit
244e672b0a
@@ -609,7 +609,7 @@ class ProtoSize {
|
||||
static constexpr uint32_t calc_int32_force(uint32_t field_id_size, int32_t value) {
|
||||
return field_id_size + (value < 0 ? 10 : varint(static_cast<uint32_t>(value)));
|
||||
}
|
||||
static constexpr inline uint32_t ESPHOME_ALWAYS_INLINE calc_uint32(uint32_t field_id_size, uint32_t value) {
|
||||
static constexpr uint32_t calc_uint32(uint32_t field_id_size, uint32_t value) {
|
||||
return value ? field_id_size + varint(value) : 0;
|
||||
}
|
||||
static constexpr uint32_t calc_uint32_force(uint32_t field_id_size, uint32_t value) {
|
||||
@@ -644,7 +644,7 @@ class ProtoSize {
|
||||
static constexpr uint32_t calc_uint64_force(uint32_t field_id_size, uint64_t value) {
|
||||
return field_id_size + varint(value);
|
||||
}
|
||||
static constexpr inline uint32_t ESPHOME_ALWAYS_INLINE calc_length(uint32_t field_id_size, size_t len) {
|
||||
static constexpr uint32_t calc_length(uint32_t field_id_size, size_t len) {
|
||||
return len ? field_id_size + varint(static_cast<uint32_t>(len)) + static_cast<uint32_t>(len) : 0;
|
||||
}
|
||||
static constexpr uint32_t calc_length_force(uint32_t field_id_size, size_t len) {
|
||||
|
||||
Reference in New Issue
Block a user