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

fix: cache the NodeAddressString #231

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Jan 4, 2023

Motivation

  • Even through the cost of computing NodeAddressString may not be a lot, it's redundant to keep computing it in the same flow
  • An example of this is the "handleFindNodes" flow where we compute NodeAddressString 5 times:
    • Session service to compute NodeAddressString, then send to Discv5 service
    • Discv5 service find 16 nodes, with 4 node per packet it'd send 4 responses
    • For each response we compute NodeAddressString again

Description

  • Cache NodeAddressString inside the INodeAddress
  • In the above flow it'd create 1 instead of 5 string

part of #201

@twoeths twoeths requested a review from a team as a code owner January 4, 2023 03:53
@wemeetagain
Copy link
Member

Can you show the benefit in terms of CPU and/or memory savings?

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