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

Reduce number of allocations in p2p #2388

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

kirugan
Copy link
Contributor

@kirugan kirugan commented Jan 20, 2025

TL;DR: instead of allocating response message on every iteration we allocate it once before iterations and reset it once we done with it after each iteration

Yesterday, I was watching a video about generics and thought that this function (particularly the reflection part) could be rewritten. Unfortunately, after 10 minutes of trial and error, I didn't succeed, but at least I found a way to reduce allocations and reflection calls.

Important: I haven't tested it fully, so please run p2p tests

Copy link

codecov bot commented Jan 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 74.68%. Comparing base (05b20ac) to head (8ce3b4d).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2388      +/-   ##
==========================================
- Coverage   74.70%   74.68%   -0.02%     
==========================================
  Files         111      111              
  Lines       12123    12123              
==========================================
- Hits         9056     9054       -2     
- Misses       2368     2370       +2     
  Partials      699      699              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@AnkushinDaniil AnkushinDaniil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2p sync works

Copy link
Contributor

@rodrigo-pino rodrigo-pino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Let's run the P2P tests before merging

@rodrigo-pino rodrigo-pino merged commit d3ff578 into main Jan 20, 2025
13 checks passed
@rodrigo-pino rodrigo-pino deleted the kirugan/reset-proto-response-message branch January 20, 2025 09:49
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.

3 participants