[spi_device] Combine log statements to reduce loop blocking - #12967
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #12967 +/- ##
=======================================
Coverage 73.46% 73.46%
=======================================
Files 53 53
Lines 11310 11310
Branches 1535 1535
=======================================
Hits 8309 8309
Misses 2602 2602
Partials 399 399 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
👋 Hi there! I've automatically requested reviews from codeowners based on the files changed in this PR. @clydebarrow - You've been requested to review this PR as codeowner(s) of 1 file(s) that were modified. Thanks for your time! 🙏 |
|
To use the changes from this PR as an external component, add the following to your ESPHome configuration YAML file: external_components:
- source: github://pr#12967
components: [spi_device]
refresh: 1h(Added by the PR bot) |
There was a problem hiding this comment.
Pull request overview
This PR combines consecutive ESP_LOGCONFIG statements in the spi_device component into a single call using multi-line string literals to reduce event loop blocking during logging operations.
Key Changes:
- Consolidates two separate
ESP_LOGCONFIGcalls into one multi-line log statement - Reduces the number of log processing operations from 2 to 1 (LOG_PIN cannot be combined as it's a separate macro)
- Results in minor reordering of dump_config output (CS pin now appears after Mode instead of before)
Memory Impact AnalysisComponents:
📊 Component Memory Breakdown
🔍 Symbol-Level Changes (click to expand)Changed Symbols
This analysis runs automatically when components change. Memory usage is measured from a representative test configuration. |
|
thanks |
What does this implement/fix?
Combine consecutive log statements into single calls using multi-line string literals.
Logging is one of the most intensive operations in ESPHome and blocks the event loop longer than most other operations. Each
ESP_LOG*call involves formatting, memory allocation, serial output, and network packet transmission. Combining consecutive log statements reduces event loop blocking and the number of network packets sent to connected clients.Note: The log processor reformats multi-line output so each line gets its own timestamp and log level prefix - the final output format is unchanged. Minor reordering of dump_config output may occur when LOG_PIN or other logging macros cannot be combined with ESP_LOG* calls - this is acceptable as it does not affect functionality.
See https://developers.esphome.io/architecture/logging/ for more details.
Types of changes
Related issue or feature (if applicable):
Pull request in esphome-docs with documentation (if applicable):
Test Environment
Example entry for
config.yaml:# N/A - no config changesChecklist:
tests/folder).If user exposed functionality or configuration variables are added/changed: