Skip to content

Conversation

@mattsre
Copy link
Contributor

@mattsre mattsre commented Dec 30, 2025

Small improvement to send_non_blocking() on multi-topic producers to use the entry API. Removes the need to clone the topic name and get the producer after inserting it. Additional removal of an unnecessary clone on the connect() method

@mattsre mattsre force-pushed the massif-clone-cleanup branch from 43ac093 to 6ed71e8 Compare December 30, 2025 06:45
.client
.producer()
.with_topic(entry.key())
.with_options(self.options.clone());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The multi-topic producer should probably share options with the inner producers to remove this clone. Would you be open to me referencing the the producer options from the multi-topic producer instead of cloning for each topic in the multi-producer? I'd need to explore how to do that without changing the single-topic producer too much

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, the core optimization of this PR is reduce two queries on a tree map (contains_key and get_mut) to one (entry) on the hot path send_non_blocking. But the case when the producer is absent should not be frequent, cloning the options is acceptable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And yes, sharing the same options makes sense.

@BewareMyPower BewareMyPower merged commit a14e8a1 into streamnative:master Jan 8, 2026
8 checks passed
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.

2 participants