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

[P2P] Increase performance of Good #2850

Merged
merged 1 commit into from
May 17, 2023

Conversation

Liquid369
Copy link
Member

This PR actually opens up our need for some more fuzzing and testing to integrate while catching up to various Bitcoin improvements.

It is a partial back port of bitcoin#22974 , reasons being we have to isolate more of the fuzz integrations so we can add them into the code base. Although this provides an improvement of over a factor of 100 for the population of the addrman 'good' peers because we iterate the table twice in order to accomplish this.

First loop is modified because in MakeTried() we can speed this up by stopping it mainly at nRefCount == 0, any further it would absolutely hit an assert. And then we can also check from the bucket that it is originating from peer wise, giving us less buckets to check.
Second loop is removed because in Good_() we look for the entry but if it is not corrupted, there's two places it would be, in new, tried or not in addr db at all. Which means at this point we would not need this and can return earlier.

Some benchmarks from upstream bitcoin#22974 (comment) bitcoin#22974 (comment)

Copy link

@panleone panleone left a comment

Choose a reason for hiding this comment

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

utACK 31e776d:
the variable nUBucket is no longer used so removing that for loop is a nice speedup,
the changes in MakeTried speed things up but the logic is the same

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

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

ACK 31e776d

@Fuzzbawls Fuzzbawls merged commit 9ea6a1b into PIVX-Project:master May 17, 2023
@Fuzzbawls Fuzzbawls modified the milestones: 6.0.0, 5.6.0 Feb 6, 2024
@Fuzzbawls Fuzzbawls changed the title Increase performance of Good [P2P] Increase performance of Good Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants