mirror of
https://github.com/esphome/esphome.git
synced 2026-03-01 02:14:19 -07:00
[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:
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user