perf(p2p/connection): Lower wasted re-allocations in sendRoutine (bac… (backport #97) #98
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.
…kport cometbft#2986) (cometbft#2995)
This PR makes sending packet messages re-use the protowriter for writing to the channel, rather than remaking it in
writePacketMsgTo
.In a 1 hour sync benchmark, this saves 10% of the time spent in the
sendRoutine
(6s), and saves 13GB of heap allocation.This is a simple fix, so I think its worth doing. Later on, I think we should move this proto-marshalling to
mConnection.Send
, but that change will require more robust testing, as it would be a tradeoff of increasing the CPU time of gossipVotesRoutine andgossipBlockPartRoutine. (I personally think it will be worth it / were anyways lowering the CPU time of these routines in total) Will be writing this later direction idea into an issue.
PR checklist
.changelog
(we use unclog to manage our changelog)docs/
orspec/
) and code comments - I actually this is simpler/dont see anything to updateThis is an automatic backport of pull request perf(p2p/connection): Lower wasted re-allocations in sendRoutine cometbft/cometbft#2986 done by Mergify.
PR checklist
.changelog
(we use unclog to manage our changelog)docs/
orspec/
) and code commentsThis is an automatic backport of pull request #97 done by [Mergify](https://mergify.com).