[Python-Dev] shared data (was: Some thoughts on the codecs...)
M.-A. Lemburg
mal@lemburg.com
Tue, 16 Nov 1999 15:36:54 +0100
Greg Ward wrote:
>
> > Go start Perl 100 times, then do the same with Python. Python is
> > significantly slower. I've actually written a web app in PHP because
> > another one that I did in Python had slow response time.
> > [ yah: the Real Man Answer is to write a real/good mod_python. ]
>
> I don't think this is the only factor in startup overhead. Try looking
> into the number of system calls for the trivial startup case of each
> interpreter:
>
> $ truss perl -e 1 2> perl.log
> $ truss python -c 1 2> python.log
>
> (This is on Solaris; I did the same thing on Linux with "strace", and on
> IRIX with "par -s -SS". Dunno about other Unices.) The results are
> interesting, and useful despite the platform and version disparities.
>
> (For the record: Python 1.5.2 on all three platforms; Perl 5.005_03 on
> Solaris, 5.004_05 on Linux, and 5.004_04 on IRIX. The Solaris is 2.6,
> using the Official CNRI Python Build by Barry, and the ditto Perl build
> by me; the Linux system is starship, using whatever Perl and Python the
> Starship Masters provide us with; the IRIX box is an elderly but
> well-maintained SGI Challenge running IRIX 5.3.)
>
> Also, this is with an empty PYTHONPATH. The Solaris build of Python has
> different prefix and exec_prefix, but on the Linux and IRIX builds, they
> are the same. (I think this will reflect poorly on the Solaris
> version.) PERLLIB, PERL5LIB, and Perl's builtin @INC should not affect
> startup of the trivial "1" script, so I haven't paid attention to them.
For kicks I've done a similar test with cgipython, the
one file version of Python 1.5.2:
> First, the size of log files (in lines), i.e. number of system calls:
>
> Solaris Linux IRIX[1]
> Perl 88 85 70
> Python 425 316 257
cgipython 182
> [1] after chopping off the summary counts from the "par" output -- ie.
> these really are the number of system calls, not the number of
> lines in the log files
>
> Next, the number of "open" calls:
>
> Solaris Linux IRIX
> Perl 16 10 9
> Python 107 71 48
cgipython 33
> (It looks as though *all* of the Perl 'open' calls are due to the
> dynamic linker going through /usr/lib and/or /lib.)
>
> And the number of unsuccessful "open" calls:
>
> Solaris Linux IRIX
> Perl 6 1 3
> Python 77 49 32
cgipython 28
Note that cgipython does search for sitecutomize.py.
>
> Number of "mmap" calls:
>
> Solaris Linux IRIX
> Perl 25 25 1
> Python 36 24 1
cgipython 13
>
> ...nope, guess we can't blame mmap for any Perl/Python startup
> disparity.
>
> How about "brk":
>
> Solaris Linux IRIX
> Perl 6 11 12
> Python 47 39 25
cgipython 41 (?)
So at least in theory, using cgipython for the intended
purpose should gain some performance.
--
Marc-Andre Lemburg
______________________________________________________________________
Y2000: 45 days left
Business: http://www.lemburg.com/
Python Pages: http://www.lemburg.com/python/