Paul Mineiro wrote:

> hi.  i'm running mod_perl 1.26 + apache 1.3.14 + perl 5.6.1
> 
> i have a loop in a mod_perl handler like so:
> ----
>   my $stime = time ();
> 
>   while ($seq =~ /CG/og)
>     { 
>       push @cg,  pos ($seq);
>     }
> 
>   my $etime = time ();
> 
>   warn "time was: ", scalar localtime ($stime), " ",
>         scalar localtime ($etime), " ", $etime - $stime;  
> ----
> 
> under mod_perl this takes 23 seconds.  running the perl "by hand" (via 
> extracting this piece into a seperate perl script) on the same data takes 
> less than 1 second.
> 
> has anyone seen this kind of extreme slowdown before?


Paul,

Your benchmark is wrong. You cannot benchmark code using wallclocks 
unless you run on DOS-like system. On multi-processes systems many 
processes compete over CPU, so each process gets a little bit of CPU 
time every so often, so if you count wallclocks you don't count the 
execution time of your program but of all programs that happen to run at 
the same time.

To count CPU clocks use Benchmark.pm, it has a fine documentation and 
examples so I won't repeat them here. Please fix your benchmark and run 
it again.

Also you may want to check certain sections in 
http://perl.apache.org/guide/performance.html


_____________________________________________________________________
Stas Bekman             JAm_pH      --   Just Another mod_perl Hacker
http://stason.org/      mod_perl Guide   http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]  http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/

Reply via email to