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

Memory/reduce allocations in peer manager #4271

Merged
merged 15 commits into from
Aug 2, 2022

Conversation

LukaszRozmej
Copy link
Member

@LukaszRozmej LukaszRozmej commented Jul 12, 2022

Changes:

Reduce allocations in peer manager
More context: https://www.notion.so/nethermind/Memory-investigations-2aa0fa86988c4bf88849a66b7328f203#60e7fde6cfee4b5c9daa3e4b8507196f

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Other (please describe): memory fragmentation and performance

Testing

Requires testing

  • Yes
  • No

In case you checked yes, did you write tests??

  • Yes
  • No

Copy link
Contributor

@kkokosa kkokosa left a comment

Choose a reason for hiding this comment

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

Looks good to me. Reduces time 3x and allocations 4x:

|                  Method |       Mean |    Error |   StdDev |  Gen 0 | Allocated |
|------------------------ |-----------:|---------:|---------:|-------:|----------:|
| CleanupCandidatePeers_1 | 1,126.9 ns | 22.51 ns | 24.08 ns | 0.0992 |   1,664 B |
| CleanupCandidatePeers_2 |   406.7 ns |  6.85 ns |  6.41 ns | 0.0262 |     440 B

Allocations are from various places:

image

Copy link
Contributor

@tanishqjasoria tanishqjasoria left a comment

Choose a reason for hiding this comment

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

Client instances seems to be running fine.

@LukaszRozmej LukaszRozmej marked this pull request as ready for review July 14, 2022 08:13
Copy link
Member Author

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

Adding comments that help with review

@LukaszRozmej LukaszRozmej requested a review from dceleda July 14, 2022 08:20
@LukaszRozmej LukaszRozmej merged commit fa1159c into master Aug 2, 2022
@LukaszRozmej LukaszRozmej deleted the memory/reduce-allocations-in-peer-manager branch August 2, 2022 22:30
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.

5 participants