snar / bgpq3

bgpq3
BSD 2-Clause "Simplified" License
363 stars 53 forks source link

The -M option causes a significant slowdown #8

Closed toreanderson closed 10 years ago

toreanderson commented 10 years ago

When the -M option is used, bgpq3 is significantly slower than without it. This even happens when building non-JUNOS filters, where -M actually becomes a no-op (i.e., the output is the same with or without it), as demonstrated here:

tore@echo:~/git/bgpq3$ time bgpq3 AS-TELENOR | md5sum 
578aff1c367b9d96fa0b57a4daafc709  -

real    0m0.847s
user    0m0.007s
sys 0m0.005s
tore@echo:~/git/bgpq3$ time bgpq3 -M foo AS-TELENOR | md5sum 
578aff1c367b9d96fa0b57a4daafc709  -

real    0m23.427s
user    0m0.009s
sys 0m0.021s

It seems odd to me that the -M option should have such a big effect on the program, after all it's just a string that should be included in Juniper-specific output, so the way I see it it shouldn't cause any additional heavy processing, network, traffic or anything else that could conceivably explain the observed slowdown.

snar commented 10 years ago

Thanks for reporting this issue. Indeed this slowdown was caused by a bug, which is fixed now.