Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf(p2p/connection): Lower wasted re-allocations in sendRoutine (bac…
…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 and gossipBlockPartRoutine. (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 - [x] Tests written/updated - should be covered by existing tests - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [x] Updated relevant documentation (`docs/` or `spec/`) and code comments - I actually this is simpler/dont see anything to update - [x] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec <hr>This is an automatic backport of pull request cometbft#2986 done by [Mergify](https://mergify.com). --------- Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com> Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
- Loading branch information