On Tue, 2008-02-19 at 20:14 -0600, Raphael Geissert wrote: > Adam D. Barratt wrote: > > On Mon, 2008-02-18 at 18:57 -0600, Raphael Geissert wrote: > >> Just make sure to select only open bugs (and probably also ignore the > >> pending ones) and call status() with the whole list of bugs (eval is your > >> friend in this case). Doing it that way was, as I said, fast an easy. > > I wasn't aware that one could pass the results of select() directly to > status() (maybe Devscripts::Debbugs does some tricks there).
No particular tricks. perl is almost certainly performing black magic in the background, but the module is basically just returning the result() of one SOAP call and passing it as the list argument of the second. > > It's easy, but I wouldn't say it was fast. I've attached a patch that > > replaces the HTML parsing with SOAP calls (admittedly including pending > > bugs; 129 out of 1945 isn't going to make a huge difference). It works, > > but testing it here it takes between five and 10 times longer than the > > original script. Admittedly my 'net connection's not the best, but the > > tests were all run in the same environment so should be comparable. > > I'm afraid I'm unable to test the changes without upgrading devscripts, > because of a 'Undefined subroutine &Devscripts::Debbugs::status called > at -e line 6.' message. You could just copy the file in to a Devscripts subfolder of wherever you're running the script from (which is how the source tree is configured). > You could compare the results directly with (warning: '<<<' is a bashism ;): > > $ s=$(date +%s); o="$(./wnpp-alert.orig.sh 2>&1)"; echo "It took $(($(date > +%s) - $s)) seconds with an output of $(wc -l <<< "$o") lines" > > $ s=$(date +%s); o="$(./wnpp-alert.new.sh 2>&1)"; echo "It took $(($(date > +%s) - $s)) seconds with an output of $(wc -l <<< "$o") lines" Yeah, I did similar using time(1). That gave results of between three and five seconds for the original script and up to 50 seconds for the SOAP patched version. > By the way, what about rewriting the whole script in perl? > Here the original script takes five seconds to run and list 44 packages, but > the new script takes five seconds to display a simple error message (the > one above). Something really needs to be optimised :). It's already been optimised at least partially :-p That's why the script directly parses dpkg's status file rather than e.g. parsing the output of dpkg-query. Adam -- To unsubscribe, send mail to [EMAIL PROTECTED]
