perf: only compute the duplicate message's MessageId when it is used - #11075
Open
hpeebles wants to merge 1 commit into
Open
perf: only compute the duplicate message's MessageId when it is used#11075hpeebles wants to merge 1 commit into
MessageId when it is used#11075hpeebles wants to merge 1 commit into
Conversation
`induct_messages()` computed `msg.content().id()` for every message, but the result is only ever read by the `debug!` in the duplicate branch; `is_duplicate()` and `induct_message()` both derive the ID themselves. `SignedIngressContent::id()` is not memoized, so each call builds a `BTreeMap`, performs a representation-independent hash (including one pass over the whole argument blob) and allocates ~20 times. Computing it only on the duplicate path removes one such derivation per inducted message, i.e. up to `MAX_INGRESS_MESSAGES_PER_BLOCK` (1000) per round. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
✅ No security or compliance issues detected. Reviewed everything up to 372ef77. Security Overview
Detected Code Changes
|
schneiderstefan
approved these changes
Aug 7, 2026
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
induct_messages()computedmsg.content().id()for every message, but the result is only ever read by thedebug!in the duplicate branch, so in the vast majority of cases the computation was unnecessary