Skip to content

perf(mqtt): move the inbound topic out of rumqttc's Publish instead of cloning - #276

Merged
lxsaah merged 1 commit into
mainfrom
perf/mqtt-native-topic-move
Oct 3, 2026
Merged

lxsaah merged 1 commit into
mainfrom
perf/mqtt-native-topic-move

Conversation

@lxsaah

@lxsaah lxsaah commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

Stage 2 of the 054 implementation plan. It removes one allocation per inbound message on the native (rumqttc) backend.

Change

MqttEventLoopSource::next owns the Publish it receives, so it now moves publish.topic out instead of cloning it. The payload is built from publish.payload first, and the debug log uses the moved String.

The payload copy (Arc::from(publish.payload.as_ref())) stays until the native backend moves to InboundDispatch later in the 054 work.

Verification

  • cargo test -p aimdb-mqtt-connector --features std: all pass.
  • cargo test -p aimdb-mqtt-connector --no-default-features --features _test-backend-parity --test backend_parity: 8 passed.
  • cargo clippy -p aimdb-mqtt-connector --features std --all-targets -- -D warnings and cargo fmt --check: clean.
  • bench-gate should not change, because the bench uses its own minimal source; CI checks it.

🤖 Generated with Claude Code

…f cloning

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lxsaah
lxsaah merged commit 4ca82b4 into main Oct 3, 2026
7 checks passed
@lxsaah
lxsaah deleted the perf/mqtt-native-topic-move branch October 3, 2026 19:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant