mirror of
https://github.com/esphome/esphome.git
synced 2025-10-03 18:42:23 +01:00
[logger] Optimize log formatting performance (33-67% faster)
This commit is contained in:
@@ -315,13 +315,11 @@ class Logger : public Component {
|
||||
}
|
||||
#endif
|
||||
|
||||
// Helper: copy fixed-length data to buffer and advance position
|
||||
static inline void copy_and_advance(char *buffer, uint16_t &pos, const char *data, uint8_t len) {
|
||||
memcpy(buffer + pos, data, len);
|
||||
pos += len;
|
||||
}
|
||||
|
||||
// Helper: copy string to buffer and advance position (calculates length with strlen)
|
||||
static inline void copy_string(char *buffer, uint16_t &pos, const char *str) {
|
||||
copy_and_advance(buffer, pos, str, strlen(str));
|
||||
}
|
||||
|
Reference in New Issue
Block a user