Uh oh!
There was an error while loading. Please reload this page.
Add a simple send-funds benchmark in channelmanager - #860
Conversation
While its not necessarily a common operation on a running node, `get_our_node_id()` is used incredibly heavily in tests, and there is no reason to not eat the extra ~64 bytes to just cache it.
Codecov Report
@@ Coverage Diff @@## main #860 +/- ##
==========================================
+ Coverage 90.60% 90.62% +0.02%
==========================================
Files 51 51 Lines 27193 27195 +2 ==========================================
+ Hits 24637 24646 +9 + Misses 2556 2549 -7
Continue to review full report at Codecov.
|
TheBlueMatt
commented
Apr 1, 2021
Our naive persister...not so much, its currently showing around 100ms for a full back-and-forth send, at least after some time as the |
TheBlueMatt
commented
Apr 1, 2021
Note that if you swap to flushing the |
TheBlueMatt
commented
Apr 1, 2021
If you go even further and cut out the duplicate fsync and file rename for ChannelMonitorUpdate writes we get down to 19ms-per-two-sends, which is much more reasonable. Branch is at https://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=shortlog;h=refs/heads/2021-03-optimize-chanmon-persist if anyone wants to go implement the reading logic for it so we can take it https://git.bitcoin.ninja/index.cgi?p=rust-lightning;a=shortlog;h=refs/heads/2021-03-optimize-chanmon-persist |
arik-so
left a comment
There was a problem hiding this comment.
Do you think it might make sense to also make a slightly more complicated benchmark with one routing node in between?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
valentinewallace
left a comment
There was a problem hiding this comment.
Approve mod CI warning :)
| use test::Bencher; | ||
| struct NodeHolder<'a, P: Persist<InMemorySigner>> { | ||
| node: &'a ChannelManager<InMemorySigner, |
There was a problem hiding this comment.
I'd be curious to compare this to an Arc'd version (i.e. using arcs instead of refs)
There was a problem hiding this comment.
I'd be astounded if it made a difference - we aren't actually cloning the Arcs anywhere that I know of here and our runtime is dominated by cryptographic operations. Non-Arc objects are nice mostly because we'd like to eventually support non-threaded applications, so we don't need trait implementations to implement Sync+Send.
Uh oh!
There was an error while loading. Please reload this page.
1424b28 to
8a9f0b8CompareTheBlueMatt
commented
Apr 1, 2021
Only difference from previous ACKs is fixed the compile warning: |
TheBlueMatt
commented
Apr 1, 2021
Hmm, there should be almost no difference there, forwarding vs initial send should be completely dwarfed by cryptographic operations. If you don't mind, I'd prefer to just take this as-is and we can follow up with more benchmarking if we think its merited later. |
I saw https://twitter.com/bottlepay/status/1376918214249218049 and was curious, so I benchmarked sends.
We're doing pretty good - on my local machine somewhere in the neighborhood of 5-6ms for two full back-and-forth sends, ignoring all IO latency.