performance patch
- Previous message (by thread): performance patch
- Next message (by thread): performance patch
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Curtis Villamizar
curtis at brookfield.ans.net
Wed Mar 18 17:41:16 CET 1998
In message <Pine.GSO.3.96.980317212825.9361D-100000 at ns.DK.net>, Robert Martin-L egene writes: > I don't run the code myself, but..... > > On Tue, 17 Mar 1998, Curtis Villamizar wrote: > > > Index: src/syntax.pl > > =================================================================== > > RCS file: /usr/local/CVS-routing-dev/irr-source/dbase/src/syntax.pl,v > > retrieving revision 2.4 > > diff -c -r2.4 syntax.pl > > *** syntax.pl 1997/11/14 20:49:12 2.4 > > --- syntax.pl 1998/03/17 19:59:25 > > *************** > > *** 490,501 **** > > # > > # Now check the actual keywords > > # > > ! while($tmppol =~ s/(\S+)//) { > > ! if (!&isaskeyword($1)) { > > ! return $O_ERROR, > > ! "syntax error in \"$ATTL{$key}: peer $as cost $pref\"\n\t$1 ". > > ! > > ! "is not a routing policy KEYWORD"; > > } > > } > > return $O_OK; > > --- 490,501 ---- > > # > > # Now check the actual keywords > > # > > ! local($tmpword); > > ! foreach $tmpword ( split("\\s+", "$tmppol") ) { > > ! if (!&isaskeyword($tmpword)) { > > ! return $O_ERROR, > > ! "syntax error in \"$ATTL{$key}: peer $as cost $pref\"\n". > > ! \t$tmpword is not a routing policy KEYWORD"; > > Aren't you missing a " in the beginning here? Yes. I debugged, edited the original change one more time, mailed, tried it and fixed it. Already mailed. Oops. > > } > > } > > return $O_OK; > > > > Also, wouldn't this use of split by ever so slightly faster? : > > split(/\s+/, $tmppol) This was a serious performance problem, not just an inconsequential tweak. It went from over an hour to a few minutes for the very long string that is the as-in statement for AS1673. The difference is changing the length of the string $tmppol a few thousand times vs a single string split operation. Whether avoiding the double quotes around $tmppol or avoiding the local variable $tmpword would cut off another few seconds doesn't really matter much. Curtis
- Previous message (by thread): performance patch
- Next message (by thread): performance patch
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[ db-wg Archives ]