Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
net processing: swap out signals for an interface class #10756
Conversation
fanquake
added the
P2P
label
Jul 7, 2017
jnewbery
referenced
this pull request
Jul 7, 2017
Open
[WIP] [wallet] Remove Wallet dependencies from init.cpp #10762
|
Super mega concept ACK. FWIW, I tested something functionally like this before (eliminating the signals with a direct function call) and saw a measurable performance improvement, I assume because there is synchronization inside the signals stuff (plus a super deep call stack). |
|
This is awesome. Lots of future work to do, but good first step. Will circle back around post-15. |
How did you test that? It'd be good to benchmark whether this gives us a performance improvement. |
jnewbery
reviewed
Jul 10, 2017
Tested ACK f785e84. A few nitty comments inline, plus one more: https://github.com/bitcoin/bitcoin/blob/master/src/net_processing.cpp#L126 seems to be a comment that's got stranded from its code, and is now nonsensical after this PR. Consider removing it entirely.
I've run this over the function test suite and it seemed to run slightly faster, though within expected variance. Do you have any ways of more focused performance testing?
| @@ -1996,15 +1996,16 @@ void CConnman::ThreadMessageHandler() | ||
| continue; | ||
| // Receive messages |
jnewbery
Jul 10, 2017
Member
Nit: move Receive messages comment into the if block (the block covers both receiving and sending messages. Having the comment outside the block suggests it's just for receiving messages)
| @@ -422,18 +423,18 @@ struct CombinerAll | ||
| }; | ||
| // Signals for message handling |
| + * Send queued protocol messages to be sent to a give node. | ||
| + * | ||
| + * @param[in] pto The node which we are sending messages to. | ||
| + * @param[in] connman The connection manager for that node. |
|
Remembering @gmaxwell's mention of it before, I was hoping to see a slight speedup here, but I haven't been able to observe anything substantial either. No test varies more than 1% from any other. @jnewbery my test was to do a sync to block 150000 between two localhost nodes running from ramdisk datadirs. I believe that focuses on the hot-spot well enough. |
|
Needed rebase after #10179, so I went ahead and squashed it down too. |
|
@jnewbery GBE connected hosts running a patch like this, out of ram, may have also required turning up our networking buffers. maybe that other locking changes we made mooted the improvement. I'll go see if I can find the relevant chat logs. |
theuni commentedJul 6, 2017
•
edited
See individual commits.
Benefits: