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.

@Stebalien Stebalien requested a review from raulk April 12, 2020 22:29
@Stebalien Stebalien force-pushed the fix_update_addrbook_loop branch from 545b1c0 to 25f38ee Compare July 20, 2021 22:23
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 force-pushed the fix_update_addrbook_loop branch from 25f38ee to 517a484 Compare July 21, 2021 00:30
@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