Re: Two debconf issues
On 05/07/01 Brendan O'Dea wrote:
> On Sat, May 05, 2001 at 02:03:59AM +0300, Shaul Karl wrote:
> >Can you compare Perl speed to Python?
> >Just curious, have no prior knowledge on this.
> Can you? Of course you can. Has someone? Very probably, although I
> can't recall seeing an instance off-hand.
> "Compare Perl speed to Python" is pretty open ended question though. In
> general? For task X? Task Y?
Here it is a comparison for one specific task: starting a graphical
application that uses the gtk bindings for either python or perl.
The comparison involves also disk and runtime memory issues as well
as completeness of the binding.
If you want more context search the gnome-hackers archives.
On 03/21/01 Alan Cox wrote:
> Perl bothers me - which perl 5.6 5.005 ... all of them are syntatically subtly
> incompatible. Perl is also about a 20Mb minimum footprint on disk.
Currently the perl binding is tested with 5.005 and 5.6, but should
work with 5.004 and probably with 5.003 too. As for the version
required by the applications I'm not aware of any significant
incompatibility at least between 5.005 -> 5.6 (check the perldelta
Also I'd like to point out that 20 Mb minimum footprint is really
20 M_b_ and not 20 MB:-)
$ dpkg -s perl-base |grep ^Installed-Size
This is version 5.6. It's likely older versions are smaller.
Note that this includes 300 KB of changelogs, so the minimum perl
installation is more like 2200 KB. A more complete perl package
will get us to about 6 MB including the development files and other
utilities written in perl.
The documentation amounts to slightly more than 6 megs for a total
of about 13 MB.
The python situation is similar:
$ dpkg -s python-base python-dev python-doc |grep ^In
For a total of about 11 MB (remember that the perl packages contain
500 KB of compressed changelogs more than python and a number of
utilities, from the profiler to sed and awk replacements).
So the difference in size doesn't hold: if redhat uses a single
big package for all of perl, it's redhat's fault:-) I wonder how
it gets to the 20 Mb figure, though, maybe it includes other
modules from CPAN?
And now to some other issues:
Loading speed in ms (on my K6 400 with 128 MB RAM):
The python program are 'from gtk import *' and 'from gnome.ui import *'.
The perl programs are 'perl -MGtk=-init -e 0' and
'perl -MGnome -e "init Gnome $0"'.
gtk 0.715 0.680 (took the best result for python and the worse for
perl in a number of runs each after a find /)
cached 0.715 0.280 (values taken after running the same program a few
times, best value for python, worst for perl: the
average for perl is about 0.230)
gnome 1.083 0.777 (same as above for the Gnome support)
cached 1.085 0.379
So, the perl binding loads 3 times faster when there is an already running
interpreter. It would be interesting to have the numbers for smaller
I'd like to have the numbers for other scripting langages bindings, too.
FYI, for C programs I get 0.105 (gtk) and 0.230 (gnome).
Memory requirements: I used the same programs as above running under
memprof (after adding a sleep() call at the end) and noting the max
memory usage. Please point out if there are better ways to do this
or if the results from this procedure are not significant for some
gtk 1032 KB 915 KB
gnome 1576 KB 1341 KB
I have already implemented a lazy-loading mechanism in cvs gnome-perl
that reduces the perl numbers to 710 KB and 1031 KB (if the
program uses _all_ the widgets in gtk and gnome there is no change
in the end, but this is unlikely).
Completeness: it's really hard to find a way to measure this, but let's
try anyway, since the results I get seem to imply the perl binding is the
more complete:-) The program I used is attached. It works this way:
for a number of libraries (libgtk, libgdk, libgnome etc. in the gnome
core) it checks the exported symbols and matches them against the
symbols required by the langauge bindings dynamic modules. I used to
use the program to find what functions are missing in my binding, but I
added a check for the python and guile modules while I was at it:-)
Note that some of the missing functions are bogus or useless for
a binding implementation. I think I have an almost complete perl,
python and guile gnome devel environment: let me know what numbers you
get (it's possible I'm missing some module or maybe the guile binding
doesn't have symbol references for all the functions it supports?).
Missing funcs in perl binding: 972/3201 total
Missing funcs in python binding: 1479/3201 total
Missing funcs in guile binding: 2220/3201 total
Perl and python use basically the same disk space.
The perl binding loads faster, uses less memory and is more complete.
Please, point out any problems you see with the above numbers or
methods or propose different ways to do the comparison (or different
firstname.lastname@example.org Monkeys do it better