darkcyde has asked for the wisdom of the Perl Monks concerning the following question:

Hey all! I've never posted a question here, but I thought this would be a good a place to ask as any... So here goes.

I just compiled Perl 5.6.0 on my Cobalt Qube 2700WG (it came with 5.004 IIRC)... and i've noticed that it seems to take a while for the interpreter to load up and then plow through my code. It doesn't seem to be terribly slow processing the code... (I've yet to run thorough benchmarks, just simple time()s and then subtracting the difference) and even on longer ones it doesn't seem to be all too noticable from a Celeron 300... but all that aside, I was wondering if anyone knew why it would take it such a long time to start out...

Its severely affecting some CGI scripts I'm writing, as it seems to take -forever- to load the interpreter and then do its thing, which isn't an issue using PHP to do even more complex things, so again, its not lackluster CPU performance (it's a R4000 @ 100MHz running Linux 2.0.34 FYI)... But since it doesn't do it elsewhere, I'm not certain what to make of it. I would rather things ran smoothly on all platforms I could be putting these things on, so it's something I would like to address at some point.

So, if anyone has a clue, that would be awesome, if not, it's back to prodding around it, eh?

Many thanks in advance!

---- john ---------------------------------------------------------------
email: john at unixninjas.org web: http://blowfish.unixninjas.org
   'knowledge is power. power corrupts. study hard, be evil.'

Replies are listed 'Best First'.
Re: Perl 5.6.0 on MIPS (R4K) - Linux
by busunsl (Vicar) on Mar 20, 2001 at 13:14 UTC
    Well, I don't know why Perl is starting so slow, but for your CGI scripts there is a solution.
    Or infact, there may be several:

    1. use mod_perl, this way perl is running inside of apache, well sort of.
    2. use fastcgi.
    and perhaps several more.

      The only problem with that, is that mod_perl is a memory hog, yes? ( I don't have vast amounts of experience with mod_perl, just a little )... and this little beast only has 48MB at the moment, up to a maximum of 64...

      I've thought about it, but it just didn't seem like a good idea (correct me if I'm wrong here of course, that's not uncommon :))... And I will look more at fastcgi, but it seems to me if perl is taking forever to load, then fastcgi may or may not help (?)

      Thanks for the advice!

      ---- john --------------------------------------------------------------------
      email: john at unixninjas.org web: http://blowfish.unixninjas.org
         'knowledge is power. power corrupts. study hard, be evil.'

Re: Perl 5.6.0 on MIPS (R4K) - Linux
by baku (Scribe) on Mar 21, 2001 at 00:09 UTC

    What kind of performance do you get if you run perl -c interactively? Can you narrow down the problem to being the shell/ld.so or the actual compiler phase?

      It takes about 3 seconds for the interpreter to load up, with or without -c from ... It just seems weird to me.. for example, I can parse an entire httpd.conf, extract vhost data and print it out to the browser in "0 seconds" (using a simple time() at the top, and a time() at the bottom... ), it just takes a while for it to start up ...

      Example:

      john@caffeine (/opt/www/tournament/cgi-bin) > perl -c menu.pl n=n
      menu.pl syntax OK
      john@caffeine (/opt/www/tournament/cgi-bin) >
      

      This takes ~2 or 3 seconds, comparable to my P60, which seems a little off perhaps (?)

      Maybe this is just normal... Although PHP4 scripts run in no time, so I'm not sure what's going on.

      Thanks!

      ---- john --------------------------------------------------------------------
      email: john at unixninjas.org web: http://blowfish.unixninjas.org
         'knowledge is power. power corrupts. study hard, be evil.'

Re: Perl 5.6.0 on MIPS (R4K) - Linux
by extremely (Priest) on Mar 21, 2001 at 01:52 UTC
    When you compiled it, did you set it up to create a libperl.a or libperl.so? You said the box is low on memory, is it going into swap when starting perl? A shared perl might be getting shoved out to swap and take a bit to come out to play again.

    Also, in that particular case, if you are happy with PHP's performance you might consider *gasp* Am I saying this? just using it. A language designed from the ground up to run in a webserver as a CGI replacement isn't that bad of a design choice.

    mod_perl is a bit of a bigger stick to hit things with =) I try not to recommend it lightly, it is a lifestyle not a haircut.

    --
    $you = new YOU;
    honk() if $you->love(perl)

      Yeah I know mod_perl is a different beast altogether, I've had a little experience programming under it, but not a whole lot... I thought I linked it statically, but I will check...

      Yeah it's statically linked, libperl.a exists, and the most recent Makefile has LIBPERL = libperl.a ...

      Although I ran some tests, and it seems to be related to loading modules / large scripts, I think that in parsing CGI.pm its taking forever, I ran some other non-CGI scripts I have written, like calculating large prime numbers, and it seems to be just fine... I wonder if it has something to do with the disk I/O ... !? eek... *sigh*

      ---- john --------------------------------------------------------------------
      email: john at unixninjas.org web: http://blowfish.unixninjas.org
         'knowledge is power. power corrupts. study hard, be evil.'