Commit 28b526a
committed
Speed up
During startup, the lightning protocol forces us to fetch a ton of
gossip for channels where there is a `channel_update` in only one
direction. We then have to wait around a while until we can prune
the crap cause we don't know when the gossip sync has completed.
Sadly, doing a large prune via `remove_stale_channels_and_tracking`
is somewhat slow. Removing a large portion of our graph currently
takes a bit more than 7.5 seconds on an i9-14900K, which can
ultimately ~hang a node with a few less GHz ~forever.
The bulk of this time is in our `IndexedMap` removals, where we
walk the entire `keys` `Vec` to remove the entry, then shift it
down after removing.
In the previous commit we shifted to a bulk removal model for
channels, here we do the same for nodes. This reduces the same test
to around 340 milliseconds on the same hardware.remove_stale_channels_and_tracking nontrivially1 parent cc028f4 commit 28b526a
2 files changed
+33
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
41 | 43 | | |
42 | 44 | | |
43 | 45 | | |
| |||
2389 | 2391 | | |
2390 | 2392 | | |
2391 | 2393 | | |
2392 | | - | |
| 2394 | + | |
| 2395 | + | |
2393 | 2396 | | |
2394 | | - | |
| 2397 | + | |
| 2398 | + | |
| 2399 | + | |
2395 | 2400 | | |
2396 | 2401 | | |
| 2402 | + | |
2397 | 2403 | | |
2398 | 2404 | | |
2399 | 2405 | | |
| |||
2632 | 2638 | | |
2633 | 2639 | | |
2634 | 2640 | | |
2635 | | - | |
| 2641 | + | |
2636 | 2642 | | |
| 2643 | + | |
2637 | 2644 | | |
2638 | 2645 | | |
2639 | 2646 | | |
2640 | 2647 | | |
2641 | 2648 | | |
2642 | 2649 | | |
2643 | 2650 | | |
2644 | | - | |
| 2651 | + | |
2645 | 2652 | | |
2646 | 2653 | | |
2647 | 2654 | | |
| |||
2654 | 2661 | | |
2655 | 2662 | | |
2656 | 2663 | | |
| 2664 | + | |
| 2665 | + | |
| 2666 | + | |
| 2667 | + | |
| 2668 | + | |
| 2669 | + | |
| 2670 | + | |
| 2671 | + | |
2657 | 2672 | | |
2658 | 2673 | | |
2659 | 2674 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
87 | 95 | | |
88 | 96 | | |
89 | 97 | | |
| |||
222 | 230 | | |
223 | 231 | | |
224 | 232 | | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
225 | 238 | | |
226 | 239 | | |
227 | 240 | | |
| |||
0 commit comments