Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(p2p/connection): Lower wasted re-allocations in sendRoutine (bac… (backport #97) #98

Merged
merged 2 commits into from
Jun 4, 2024

Conversation

mergify[bot]
Copy link

@mergify mergify bot commented Jun 3, 2024

…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



PR checklist

  • Tests written/updated
  • Changelog entry added in .changelog (we use unclog to manage our changelog)
  • Updated relevant documentation (docs/ or spec/) and code comments

This is an automatic backport of pull request #97 done by [Mergify](https://mergify.com).

mergify bot and others added 2 commits June 3, 2024 22:04
…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 <[email protected]>
Co-authored-by: Anton Kaliaev <[email protected]>
(cherry picked from commit 7954daf)
(cherry picked from commit 02fe4dc)
@ValarDragon ValarDragon merged commit ba57909 into osmo-v25/v0.37.4 Jun 4, 2024
14 of 16 checks passed
@mergify mergify bot deleted the mergify/bp/osmo-v25/v0.37.4/pr-97 branch June 4, 2024 13:27
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.

1 participant