-
Notifications
You must be signed in to change notification settings - Fork 35.8k
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
Allow SendMessages to run partially without cs_main #2840
Conversation
Added a few more lock improvements. |
Rebased. |
Does this make the code more stable or is it a performance-improving patch? That locking stuff isn't my main expertise ^^. |
@Diapolo It improves performance/throughput, by allowing more code to run without needing the cs_main lock, and conversely, holding that lock for a shorter time, so more other code can run in parallel. At this point the improvements may not be noticable, but if we ever want a decently parallellizable core, we can't avoid doing this everywhere it's possible. |
Rebased. PS: the first commit may look large, but it really just changes some indentation. If needed, I can make a version that keeps the indentation identical for now. |
if (!AlreadyHave(inv)) | ||
{ | ||
if (fDebugNet) | ||
printf("sending getdata: %s\n", inv.ToString().c_str()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be LogPrint("net", ...)
Looks good to me except for an errant printf (reviewed using a graphical diff tool-- opendiff on the mac-- using its "compress whitespace" preference). |
Modified to not do indentation changes for now. |
SendMessages() tries to acquire a cs_main lock now, but this isn't nessecary for much of its functionality. Move those parts out of the locked section, so they can always be performed, and we hold cs_main for a shorter time.
Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/7d38af3c493f9ea24c722ec2e6d3c51f4e851364 for binaries and test log. |
Allow SendMessages to run partially without cs_main
SendMessages() tries to acquire a cs_main lock now, but this isn't nessecary for much of its functionality. Move those parts out of the if condition.