bgpd: remove calls to peer_sort() from fast-path
peer_sort() it's called so much as to be annoying. In the assumption
that the 'sort' of the peer doesn't change during an established session,
I have changed all calls to peer_sort() in the 'fast-path' to only check
the 'sort'. All the calls from the vty and such still recalculate the sort
and store it in the peer.
There's a lot of other calls to peer_sort() that could be changed but some
maube tricky, someone more knowledgeable may try to reduce them.
This hits peer_sort() from 5th out of the stadium^H^H list on a full
internet table loading profiling session.
Signed-off-by: Jorge Boncompte [DTI2] <jorge@dti2.net>
Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_mpath.c b/bgpd/bgp_mpath.c
index aa657d8..7999d16 100644
--- a/bgpd/bgp_mpath.c
+++ b/bgpd/bgp_mpath.c
@@ -420,7 +420,7 @@
mpath_count++;
if (new_best != old_best)
bgp_info_mpath_dequeue (new_best);
- maxpaths = (peer_sort (new_best->peer) == BGP_PEER_IBGP) ?
+ maxpaths = (new_best->peer->sort == BGP_PEER_IBGP) ?
mpath_cfg->maxpaths_ibgp : mpath_cfg->maxpaths_ebgp;
}