> -----Original Message-----
> From: Trevor Nichols [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, June 04, 2002 9:53 AM
> To: [EMAIL PROTECTED]
> Subject: Slow script
> 
> 
> Hi All,
> 
> I've got two machines here which are pretty crappy but there 
> seems to be
> something seriously wrong somewhere.  One machine, a Pentium 200 MMX
> with 80MB ram runs a very simple script taking 5 seconds.
> 
> t@data:~$ cat test.pl
> use diagnostics;
> use strict;
> 
> print "hi\n";
> t@data:~$ time perl test.pl
> hi
> 
> real    0m5.105s
> user    0m4.990s
> sys     0m0.100s
> 
> The same script without the use diagnostics and use strict provides a
> much faster execution.
> 
> t@data:~$ time perl test.pl
> hi
> 
> real    0m0.113s
> user    0m0.060s
> sys     0m0.050s
> t@data:~$ cat test.pl
> print "hi\n";
> 
> I'm actually trying to setup a CGI script and it appears very slow.  I
> tracked the majority of the speed problems to those two 
> statements.  Is
> this normal or do I need to run these scripts on a faster computer?  I
> would think that should not be necessisary.

This isn't normal, no.

Run "perl -V" and look at @INC; these are the directories to be searched
for modules included with "use". Make sure this list is sane. Are any of
these on NFS file systems? I suspect the problem is in searching or
accessing these directories.

Run "perldoc -l strict". It will display something like:

   /usr/local/lib/perl5/5.6.1/strict.pm

Remove "use diagnostics" and change your "use strict;" to

   do "/usr/local/lib/perl5/5.6.1/strict.pm";

Does it run quickly? Can you just "cat" or "more" this file?

(n.b. you probably don't want use diagnostics in production code).

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to