Skip to content

Commit 3f223ec

Browse files
Copilotcziter15
andauthored
perf: optimize MQTT logging with string pre-allocation (#93)
* Initial plan * perf: optimize millis64, component loop, and MQTT logging Co-authored-by: cziter15 <[email protected]> * perf: revert millis64 lazy-eval to pre-update approach Co-authored-by: cziter15 <[email protected]> * perf: improve branch prediction by hinting on component state Co-authored-by: cziter15 <[email protected]> * perf: remove __builtin_expect as ESP has no branch prediction Co-authored-by: cziter15 <[email protected]> --------- Co-authored-by: copilot-swe-agent[bot] <[email protected]> Co-authored-by: cziter15 <[email protected]>
1 parent 18f194e commit 3f223ec

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/ksf/comp/ksMqttConnector.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ namespace ksf::comps
119119

120120
#ifdef APP_LOG_ENABLED
121121
app->log([&](std::string& out) {
122+
out.reserve(64 + topicStr.length() + payloadStr.length());
122123
out += PSTR("[ MqttConnector ] Received on topic: ");
123124
out += topicStr;
124125
out += PSTR(", value: ");

0 commit comments

Comments
 (0)