[web_server] Remove unnecessary packed attribute from DeferredEvent

DeferredEvent contains two pointers (void* + function pointer), which
are already naturally 4-byte aligned on all ESPHome targets. The struct
is 8 bytes with no padding regardless of packed.

The packed attribute forces the compiler to use byte-by-byte loads and
stores instead of word-aligned access, bloating deq_push_back_with_dedup_
from 163 to 317 bytes due to shift/mask/or sequences for every field
access.

The packed attribute was added in #7538 likely to guarantee the struct
stayed at 8 bytes, but this is already the case without it since both
fields are pointer-sized.
This commit is contained in:
J. Nick Koston
2026-02-11 08:11:31 -06:00
parent 38bba3f5a2
commit e139722e9d
2 changed files with 2 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ class DeferredUpdateEventSource : public AsyncEventSource {
bool operator==(const DeferredEvent &test) const {
return (source_ == test.source_ && message_generator_ == test.message_generator_);
}
} __attribute__((packed));
};
protected:
// surface a couple methods from the base class

View File

@@ -277,7 +277,7 @@ struct DeferredEvent {
bool operator==(const DeferredEvent &test) const {
return (source_ == test.source_ && message_generator_ == test.message_generator_);
}
} __attribute__((packed));
};
class AsyncEventSourceResponse {
friend class AsyncEventSource;