Skip to content

v2.2.1 — route() allocation cleanup

Latest

Choose a tag to compare

@iamaliybi iamaliybi released this 08 Jul 23:13
c134859

Internal hot-path cleanup. No wire, config, or behavioural change over 2.2.0.

Changed

  • route() fan-out no longer clones a client_id per matched subscriber. The per-publish best/groups maps now key on the subscriber's borrowed &str (from the topic trie) instead of an owned String, via a disjoint-field-borrow of ShardState (the trie stays borrowed across the whole fan-out while delivery reaches sessions/wal/unpark_tx through a free deliver_to). This removes one heap allocation per matched subscriber per message — ~15M allocations/second at a 1000-subscriber fan-out.

Honest note on impact: this is an allocation reduction and a borrow-structure simplification, not a measured throughput win. On a CPU-saturated 1000-subscriber fan-out the publish rate is unchanged within run-to-run noise (~64 µs/publish before and after) — the per-delivery cost is dominated by the mailbox try_send and Delivery construction, not the short-string allocation. Shipped for the cleaner structure and reduced allocator traffic (which can still matter under memory pressure or a different allocator), with no performance claim attached. Full suite green (120 unit + 23 integration, including shared-subscription exactly-once, cross-shard, No Local, and Subscription Identifier echo).

Assets: rusquitto-x86_64-unknown-linux-gnu, rusquitto-aarch64-unknown-linux-gnu (zig-built, glibc 2.31), and the annotated rusquitto.config.toml. Full history in CHANGELOG.md.