Skip to content
This repository has been archived by the owner on Aug 19, 2022. It is now read-only.

Fix perfomance issue in updating addr book #141

Merged
merged 2 commits into from
Jul 21, 2021

Conversation

pymq
Copy link
Contributor

@pymq pymq commented Apr 12, 2020

After recent upgrade to latest libp2p libraries I saw that my app runs 10% cpu in idle. After debugging I found that this function sometimes do 40000*80000 (1-4 billion) iterations. I don't known why it gets so many addresses (on average there is only 10-200 addresses), so I only fix this complexity issue.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

Sorry for the very looooong delay. This fell off everyone's radar.

@Stebalien Stebalien enabled auto-merge July 20, 2021 22:25
pymq and others added 2 commits July 20, 2021 17:30
1. Remove duplicate import.
2. Lift empty check to simplify code.
3. Use a more efficient map key (go will optimize this to not allocate).
@Stebalien Stebalien disabled auto-merge July 21, 2021 00:30
@Stebalien Stebalien enabled auto-merge July 21, 2021 00:30
@Stebalien Stebalien merged commit f7f2256 into libp2p:master Jul 21, 2021
@aschmahmann aschmahmann mentioned this pull request Aug 23, 2021
62 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants