mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-24 01:24:26 +01:00
lightningd: use hash map for peers instead of linked list.
After connecting 100,000 peers with one channel each (not all at once!), we see various places where we exhibit O(N^2) behaviour. Fix these by keeping a map of id->peer instead of a simple linked-list. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
committed by
Alex Myers
parent
17aa047b17
commit
cfa632b0e9
@@ -155,6 +155,7 @@ static void finish_report(const struct leak_detect *leaks)
|
||||
memleak_scan_htable(memtable, &ld->htlcs_in->raw);
|
||||
memleak_scan_htable(memtable, &ld->htlcs_out->raw);
|
||||
memleak_scan_htable(memtable, &ld->htlc_sets->raw);
|
||||
memleak_scan_htable(memtable, &ld->peers->raw);
|
||||
|
||||
/* Now delete ld and those which it has pointers to. */
|
||||
memleak_scan_obj(memtable, ld);
|
||||
|
||||
Reference in New Issue
Block a user