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

Optimize allocations in peerFound #594

Closed
Stebalien opened this issue Apr 20, 2020 · 3 comments
Closed

Optimize allocations in peerFound #594

Stebalien opened this issue Apr 20, 2020 · 3 comments
Assignees
Labels
kind/enhancement A net-new feature or improvement to an existing feature

Comments

@Stebalien
Copy link
Member

peerFound is called in response to every single DHT query to update our routing table. However, it allocates quite frequently.

  1. We should avoid calling ConvertToStrings every time. Instead, we should cache the string versions of our DHT protocols.
  2. We may want an efficient alternative to ps.SupportsProtocols that doesn't allocate.

Together, these account for 22% of allocations (by number, not size) on a bootstrapper.

Besides that, we also do quite a bit of allocation when actually trying to add peers to the routing table (e.g., we get a list of all peers in the bucket to see if we need to kick any out).

@Stebalien Stebalien added the kind/enhancement A net-new feature or improvement to an existing feature label Apr 20, 2020
@aarshkshah1992 aarshkshah1992 self-assigned this Apr 21, 2020
@aarshkshah1992
Copy link
Contributor

@Stebalien I'm picking this up. Will get in along with the Routing Table manager refactor.

@Stebalien
Copy link
Member Author

Let's revise that 22% to 66%.

@aarshkshah1992
Copy link
Contributor

Merged in #631.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement A net-new feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants