Re: official support for more scripting languages in gnome needed



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 
manpage).

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
Installed-Size: 2520

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
Installed-Size: 2696
Installed-Size: 1132
Installed-Size: 6968

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"'.

	python	perl
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 /)
gtk
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)
gnome
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
machines, though.
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 
reason.

	python	perl
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

Executive summary:
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
comparisons altoghether).

lupus (who is trying to provide numbers and not to start flamewars:-)

-- 
-----------------------------------------------------------------
lupus debian org                                     debian/rules
lupus ximian com                             Monkeys do it better
#!/usr/bin/perl -w

@libs = qw(
	libgdk-1.2.so.0 libgtk-1.2.so.0 libgnomeui.so.32 libzvt.so.2 
	libpanel_applet.so.0 libgdk_pixbuf.so.2 libgnomeprint.so.11
	libgnome.so.32 libgdk_imlib.so.1 libgtkhtml.so.7 libgtkxmhtml.so.1
);

$lang = shift || 'perl';

if ($lang eq 'perl') {
	@modules = `find . -name \*.so`;
} elsif ($lang eq 'python') {
	@modules = glob("/usr/lib/python1.5/site-packages/*.so");
} elsif ($lang eq 'guile') {
	@modules = glob("/usr/lib/libguile*.so.0");
}

@nobind{qw(gtk_input_add_full gtk_input_remove)} = ();
foreach (qw(set setv get getv newv)) {
	$nobind{"gtk_widget_".$_} = 1;
}

%funcs = ();
$ident = '[_a-zA-Z][_a-zA-Z0-9]*';

for $i (@libs) {
	$i = "/usr/lib/$i" unless -f $i;
	open(N, "nm -D $i|") || die "Cannot open pipe: $!\n";
	while(<N>) {
		next unless / T ($ident)/o;
		$f = $1;
		next if $f =~ m/^(_|g_|gt1_|Xm|html_|gp_|gtk_marshal_|GNOME_|_ORBIT|POA_|vt_|CORBA_)/;
		$funcs{$f} = 1 unless exists $nobind{$f};
	}
	close(N);
}
$total = scalar(keys %funcs);
foreach $i (@modules) {
	open(N, "nm -D $i|") || die "Cannot open pipe: $!\n";
	while(<N>) {
		next unless / U ($ident)/o;
		delete $funcs{$1};
	}
	close(N);
}

print "Missing funcs in $lang binding: ", scalar(keys %funcs), "/$total total\n";
#print join("\n", sort keys %funcs), "\n";



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]