On Tuesday 17 June 2003 18:18, Ged Haywood wrote:
> 
> Do you know for sure that the Per was compiled for i686?  Maybe it was
> compiled for i386, so it would run on just about anything but it can't
> use a lot of the faster features found in later processors.

Whether it's i686 or i386 - both mod_perl and FastCGI are using the same 
compile of perl - so what difference should there be?

Right! I've put together a test case, which has nothing to do with my EDO 
project. It's just a simple iterative loop, with subroutine calls, updating a 
hash. I've included the main module "Thrash.pm", which does the work, and 
doubles as the mod_perl Apache module. I've included a FastCGI version, and a 
plain CGI version (which can also be run from the command line), all using 
Thrash.pm. I've also attached a .htaccess file setting up "thrash.html" to be 
handled by Thrash.pm.

On my main dev box, ab gives an average of 8.8secs for the mod_perl run, and 
7.2secs for the FastCGI run. The internal timer and printed output reflects 
these results too. 

Interestingly, the time to clear the hash after building it is quite large. 
^_^

I commented out the hash adding code, to remove the hash processing, and leave 
it more as a subroutine call test, but mod_perl was still slower, with 
benchmarks of 3.7secs for mod_perl, and 2.7secs for FastCGI.

I've only tested this on one server so far. I'll test it on others now... I'd 
be interested to hear if others get this discrepancy on their servers...

-- 
. Trevor Phillips             -           http://jurai.murdoch.edu.au/ . 
: Web Technical Administrator     -          [EMAIL PROTECTED] : 
| IT Services                        -              Murdoch University | 
 >--------------------------------------------------------------------<
| On nights such as this, evil deeds are done. And good deeds, of     /
| course. But mostly evil, on the whole.                             /
 \      -- (Terry Pratchett, Wyrd Sisters)                          /
package Thrash;

$Count = 0;
%Hash = ();

use Apache::Constants qw(:common);
use Apache::Request ();
eval "use Time::HiRes;";
if (!$@)
{
   $Thrash::UseTimeHiRes = 1;
}

sub handler
{
   my $r = shift;  # The Raw handler...
   $r->send_http_header;
   $r->print(&Thrash::DoIt());
   return OK;
}

sub DoIt
{
   my $TIME_start = ($UseTimeHiRes?Time::HiRes::time():time());
   my $out = "<H1>Thrash Test</H1>\n";

   $Count = 0;
   %Hash = ();
   foreach my $A (qw(0 1 2 3 4 5 6 7 8 9 A B C D E F))
   {
      SubThrash(0,$A);
      $out.="$A / $Count<BR>\n";
   }
   $out.=sprintf('<B>Run Time: %.3f</B>',($UseTimeHiRes?Time::HiRes::time():time())-$TIME_start);
   %Hash = ();  # Clear Hash now we're done.
   return $out;
}

sub SubThrash
{
   my ($depth,$key) = @_;
   if ($depth==3)
   {
      $Count++;
#      $Hash{$key} = $Count;
      return;
   }
   foreach my $B (qw(a b c d e f g h i j k l m n o p q r s t u v w x y z))
   {
      SubThrash($depth+1,$key.$B);
   }
}
1;

Attachment: thrash.cgi
Description: Binary data

Attachment: thrash.fcgi
Description: Binary data

Attachment: .htaccess
Description: Binary data

Reply via email to