From owner-freebsd-questions Mon Jul 5 8:10: 6 1999 Delivered-To: freebsd-questions@freebsd.org Received: from plab.ku.dk (plab.ku.dk [130.225.105.65]) by hub.freebsd.org (Postfix) with ESMTP id 7BCA71534C for ; Mon, 5 Jul 1999 08:09:54 -0700 (PDT) (envelope-from tobez@plab.ku.dk) Received: from lion.plab.ku.dk (lion.plab.ku.dk [130.225.105.49]) by plab.ku.dk (8.9.1/8.9.1) with ESMTP id RAA18552; Mon, 5 Jul 1999 17:09:52 +0200 (CEST) Received: (from tobez@localhost) by lion.plab.ku.dk (8.9.3/8.9.3) id RAA07985; Mon, 5 Jul 1999 17:07:38 +0200 (CEST) (envelope-from tobez) Date: Mon, 5 Jul 1999 17:07:38 +0200 From: Anton Berezin To: Dan Langille Cc: freebsd-questions@FreeBSD.ORG Subject: Re: running frequent cron perl scripts Message-ID: <19990705170738.D5735@lion.plab.ku.dk> References: <19990705111124.ZBJY282564.mta1-rme@wocker> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95.4i In-Reply-To: <19990705111124.ZBJY282564.mta1-rme@wocker>; from Dan Langille on Mon, Jul 05, 1999 at 11:08:02PM +1200 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG On Mon, Jul 05, 1999 at 11:08:02PM +1200, Dan Langille wrote: > I'm running cron job to start up a perl script. The script accesses > the ADSL modem to see if the external IP address has changed. If it > has, it runs another job to update the DNS. The ADSL modem has an > http interface which has the details I need. > The perl script takes about 35 seconds to run on this old 486. But > I'm guessing that most of that is overhead. The first bit of the > script is: > #!/usr/bin/perl > $| = 1; > use CGI; > use CGI::Carp (fatalsToBrowser); > require LWP; > Is there a way to speed this process up? The above bits seem to take > up most of the time. You should definitely remove use CGI::Carp here. And use CGI - almost definitely. Which capabilities of CGI.pm do you need, anyway? I guess that $| = 1 is alright here, but... Depending on the amount of output to STDOUT this script does, this statement can considerably slow things down. Are you doing intelligent things with modem's http interface? In most cases, LWP::Simple is enough. And finally, the fact you presented us with just a few first lines of your script suggests that you think that the startup overhead is the major slowing factor. Are you sure of it? I mean, judging from your use of CGI::Carp in non-cgi environment, you are not very good in Perl, so the possibility that script does something in, uhmm, not the most efficient fashion is far from remote. :-) Show us more... Regards, -- Anton Berezin The Protein Laboratory, University of Copenhagen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message