]> git.puffer.fish Git - mirror/frr.git/commit
vtysh: Speed up output of configuration across daemons 6815/head
authorDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 28 Jul 2020 14:58:47 +0000 (10:58 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Tue, 4 Aug 2020 14:32:03 +0000 (10:32 -0400)
commitece0e6efa7bae5272461471bab51dbb3bfc3053a
tree44b9cdd38aa4057d4a940fe5c0fa9a89b5bc3e8a
parentde5f29dabda30d58c8b25e82245b9ad2bae485b4
vtysh: Speed up output of configuration across daemons

With a config that contains a large number of prefix-lists a 'show run' command
was an expensive operation:

sharpd@eva ~/frr_internal2 ((cl4.1.0))> time vtysh -c "show run" | grep ACTIVE | wc -l
32397
________________________________________________________
Executed in   14.53 secs   fish           external
   usr time   14.45 secs  591.00 micros   14.45 secs
   sys time    0.03 secs  189.00 micros    0.03 secs
sharpd@eva ~/frr_internal2 ((cl4.1.0))>

Effectively we are keeping a linked list of data to store the configuration.
When we received a new item we would look in the list to see if it already
does, by doing a string search across each element in the list.

Add to the master configuration a hash of items for O(1) lookup.
Keep the list for order so we don't mangle that up.

New time:
sharpd@eva ~/frr_internal1 (dev)> time vtysh -c "show run" | grep ACTIVE | wc -l
32397
________________________________________________________
Executed in  277.94 millis    fish           external
   usr time  237.46 millis   20.53 millis  216.93 millis
   sys time   14.31 millis    0.00 millis   14.31 millis

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
vtysh/vtysh_config.c