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

Remove unnecessary node lists in NodeList module to improve performance #16

Merged
merged 2 commits into from
May 14, 2024

Conversation

tanuj-shardeum
Copy link
Contributor

No description provided.

Copy link

linear bot commented May 3, 2024

BLUE-56 Refactor maintaining nodelist in the archivers.

ISSUE SUMMARY:

The archiver is keeping nodes in multiple lists ( which are repetitive and are not being used really. )

const list: ConsensusNodeInfo[] = []

const standbyList: Map<string, ConsensusNodeInfo> = new Map() ***

const syncingList: Map<string, ConsensusNodeInfo> = new Map() ***

const activeList: Map<string, ConsensusNodeInfo> = new Map() ***

export let activeListByIdSorted: ConsensusNodeInfo[] = [] ***

export let byPublicKey:local { [publicKey: string]: ConsensusNodeInfo } = {}

let byIpPort: { [ipPort: string]: ConsensusNodeInfo } = {} ***

export let byId: { [id: string]: ConsensusNodeInfo } = {} *** change as id -> publicKey

let publicKeyToId: { [publicKey: string]: string } = {}

*** are needed one

We might be able to remove the remaining ones.

<<TODO: Replace this with a short summary of the issue.>>


ISSUE REPRO STEPS:

<HINT: Add steps to list as-needed. If interaction is complex, add screenshots or a Slack screen-capture video (just drag and drop)>

  1. <<TODO: Replace with repro step Bump the npm_and_yarn group across 1 directory with 3 updates #1>>
  2. <<TODO: Replace with repro step Challenge receipt #2>>
  3. Observe <<TODO: Describe unintended behavior.>>

EXPECTED RESULT:

<<TODO: Replace this with your expected results.>>


MERGE REQUESTS:

<HINT: If your fix requires changes in multiple repos, add the following info per-repository.>

<<TODO: Enter Repository Name>>

Pull Request Link: <<TODO: Insert PR-LINK>>

GPT Review Link: <<TODO: Insert GPT-Review-Link>>

Jenkins Test Link: <<TODO: Insert Jenkins Test Job Link>>


ADDITIONAL INSTRUCTIONS:

<HINT: Add any additional instructions needed for the assignee. If you have specific requirements for how the task should be implemented or fixed, enter them or link them here.>

<<TODO: Insert additional instructions for assignee.>>

@tanuj-shardeum
Copy link
Contributor Author

  1. Remove unnecessary lists:

    • Remove publicKeyToId: This mapping is redundant as its functionality can be achieved using the byId list.
    • Remove byIpPort: This list is unused in the codebase.
    • Remove 'list': Same functionality can achieved using the byPublicKey list, without much computational overhead,
  2. Optimize space used by existing lists:

    • Update byId to map only IDs to public keys instead of storing the entire nodeInfo. This allows for more efficient data storage and retrieval.
  3. Replace 'Objects used as HashMaps' with the Map data structure for improved efficiency in operations.

  4. Fix minor bugs related to list operations.

@tanuj-shardeum tanuj-shardeum marked this pull request as ready for review May 6, 2024 05:48
@jairajdev jairajdev merged commit 48dacfe into dev May 14, 2024
2 checks passed
@mhanson-github mhanson-github deleted the BLUE-56 branch August 30, 2024 22:22
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.

2 participants