Up Prev Next
From: Christopher Jobson <jobson at sybase dot com>
Subject: Re: Perl5 startup speed
Date: Mar 18 1996 9:35AM
> We are trying to convert some of our old sybperl (4) cgi scripts
> to use Perl5. The good news is that most scripts work without
> modification (statements such as 'print "name@domain"' give an
> error about the un-escaped '@', which I can fix easily enough).
> The bad news is that the startup time for perl5 is significantly
> longer than perl4! Since the scripts are running in response to a web
> browser,adding 3-7 seconds to a 1 second script is quite noticable.
> Using some 1 or 2 line scripts of basically print "$0 :" with
> or without require/use, we get these times:
> hello.4: 0s real 0.000s user 0.030s system
> sybperl.4: 1s real 0.070s user 0.100s system 0%
> hello.5: 0s real 0.030s user 0.030s system
> sybperl.5: 2s real 1.170s user 0.260s system 50%
> dblib.5: 1s real 0.240s user 0.090s system 0%
> ctlib.5: 7s real 1.010s user 0.150s system 14%
> Notice that the 2 line script:
> use Sybase::CTlib;
> print "$0 :"
> takes 7 seconds to complete.
I have seen exactly this problem, doing pretty well what you did: move from
perl 4.x to 5.0. The parse time has gone up from under a second for a fairly
large script (2000+ lines) to 5-7 seconds. Efectively I abandoned the upgrade
as it was proving just too slow to use 5.0, and I am sticking with perl 4
I tried using static loading, as opposed to dynamic, and this didn't help
either. I also tried to use the 'dump' and 'undump' feature: basically
parsing/compiling the perl script, and saving the results so that the program
could be started up immediately. This helped a lot: startup time almost
disappeared. But I discovered that the 'undumped' binary was extremely platform
dependent, and as the script is run on a variety of machines (all sun4, 4.1.x),
it proved difficult getting this approach to work.
I put out a help message on comp.lang.perl.misc, but received no helpful
suggestions so assumed I must be the only sufferer !!
If anyone else has any clues, or advice for reducing the startup time, that
would be wonderful !