mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 08:55:36 +00:00
Use pointer iteration in call() to avoid uint16_t movzx overhead on x86-64
This commit is contained in:
@@ -1834,8 +1834,9 @@ template<typename... Ts> class CallbackManager<void(Ts...)> {
|
||||
|
||||
/// Call all callbacks in this manager.
|
||||
void call(Ts... args) {
|
||||
for (uint16_t i = 0; i < this->size_; i++)
|
||||
this->data_[i].call(args...);
|
||||
for (auto *it = this->data_, *end = it + this->size_; it != end; ++it) {
|
||||
it->call(args...);
|
||||
}
|
||||
}
|
||||
uint16_t size() const { return this->size_; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user