From ee06c71efc046f2103bf54451b284278e3ea57a9 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 18 Dec 2017 14:45:31 +1030 Subject: [PATCH] gossipd: make routing far less chatty. # 100,000 nodes $ ./gossipd/test/run-bench-find_route 100000 1 > /tmp/out => 5357 msec # 1M nodes: $ /gossipd/test/run-bench-find_route 1000000 1 > /tmp/out => 55064 msec # 1M nodes with CDEBUGFLAGS='-std=gnu11 -g -fstack-protector -O3 -flto' and manual linking with '-flto': $ /gossipd/test/run-bench-find_route 1000000 1 > /tmp/out => 33501 msec Signed-off-by: Rusty Russell --- gossipd/routing.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/gossipd/routing.c b/gossipd/routing.c index 5540dfad9..9c49b96de 100644 --- a/gossipd/routing.c +++ b/gossipd/routing.c @@ -14,6 +14,10 @@ #include #include +#ifndef SUPERVERBOSE +#define SUPERVERBOSE(...) +#endif + /* 365.25 * 24 * 60 / 10 */ #define BLOCKS_PER_YEAR 52596 @@ -285,7 +289,7 @@ static void bfg_one_edge(struct node *node, size_t edgenum, double riskfactor) c->delay, riskfactor); if (node->bfg[h].total + (s64)fee + (s64)risk < c->src->bfg[h+1].total + (s64)c->src->bfg[h+1].risk) { - status_trace("...%s can reach here in hoplen %zu total %"PRIu64, + SUPERVERBOSE("...%s can reach here in hoplen %zu total %"PRIu64, type_to_string(trc, struct pubkey, &c->src->id), h, node->bfg[h].total + fee); @@ -334,23 +338,23 @@ find_route(const tal_t *ctx, struct routing_state *rstate, src->bfg[0].risk = 0; for (runs = 0; runs < ROUTING_MAX_HOPS; runs++) { - status_trace("Run %i", runs); + SUPERVERBOSE("Run %i", runs); /* Run through every edge. */ for (n = node_map_first(rstate->nodes, &it); n; n = node_map_next(rstate->nodes, &it)) { size_t num_edges = tal_count(n->in); for (i = 0; i < num_edges; i++) { - status_trace("Node %s edge %i/%zu", + SUPERVERBOSE("Node %s edge %i/%zu", type_to_string(trc, struct pubkey, &n->id), i, num_edges); if (!n->in[i]->active) { - status_trace("...inactive"); + SUPERVERBOSE("...inactive"); continue; } bfg_one_edge(n, i, riskfactor); - status_trace("...done"); + SUPERVERBOSE("...done"); } } }