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

Commits on Jun 3, 2024

  1. 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 <[email protected]>
    Co-authored-by: Anton Kaliaev <[email protected]>
    (cherry picked from commit 7954daf)
    mergify[bot] committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    20edfc2 View commit details
    Browse the repository at this point in the history
  2. Add Changelog

    (cherry picked from commit 02fe4dc)
    ValarDragon authored and mergify[bot] committed Jun 3, 2024
    Configuration menu
    Copy the full SHA
    bd944c1 View commit details
    Browse the repository at this point in the history