develooper Front page | perl.perl5.porters | Postings from November 2004

Re: getting Config.pm on a diet

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
November 27, 2004 14:29
Subject:
Re: getting Config.pm on a diet
Message ID:
20041127222913.GV8234@plum.flirble.org
On Sat, Nov 27, 2004 at 05:28:17PM +0000, Nicholas Clark wrote:

> Anyway, change 23554 is now in, and with luck won't break on VMS or Windows
> (or anything Unix for that matter)

Which I checked, and it's fortunate that I did (and make a habit of it)
because it broke on anything with a case sensitive file system. Mmm. HFS+.

Anyway, I modified Config.pm to log which entries are really read:

--- build/lib/perl5/5.8.5/i686-linux/Config.pm~ 2004-11-27 20:56:18.000000000 +0000
+++ build/lib/perl5/5.8.5/i686-linux/Config.pm  2004-11-27 21:00:16.000000000 +0000
@@ -1187,9 +1187,20 @@ sub fetch_virtual {
     $self->{$key} = $value;
 }
 
+my %uses;
+
+END {
+    my $file = "/home/nick/Fotango/Build-585/configdb";
+    local *F;
+    open F, ">>", $file or die "Config $file: $!";
+    while (my ($k, $v) = each %uses) {
+       print F "$k:$v\n";
+    }
+}
+
 sub FETCH { 
     my($self, $key) = @_;
-
+    $uses{$key}++;
     # check for cached value (which may be undef so we use exists not defined)
     return $self->{$key} if exists $self->{$key};
 
and build stuff using the Fotango build system, on the assumption that all
the tests in all the modules with all their dependencies would give a
possibly more balanced view of what really gets used in %Config. The
assumption to date has been:

  archname osname osvers prefix libs libpth dynamic_ext static_ext dlsrc so cc
  ccflags cppflags privlibexp archlibexp installprivlib installarchlib
  sharpbang startsh shsharp

possibly based on older data. The top 50 I find to be somewhat different
(here with number of access and their values):

path_sep:       8490    ':'
d_readlink:     7101    'define'
d_symlink:      7101    'define'
archlibexp:     4318    '/home/nick/Fotango/Build-585/build/lib/perl5/5.8.5/i686-linux'
sitearchexp:    4305    '/home/nick/Fotango/Build-585/build/lib/perl5/site_perl/5.8.5/i686-linux'
sitelibexp:     4305    '/home/nick/Fotango/Build-585/build/lib/perl5/site_perl/5.8.5'
privlibexp:     4163    '/home/nick/Fotango/Build-585/build/lib/perl5/5.8.5'
ldlibpthname:   4041    'LD_LIBRARY_PATH'
libpth: 2134    '/usr/local/lib /lib /usr/lib'
archname:       1591    'i686-linux'
exe_ext:        1256    ''
scriptdir:      1155    '/home/nick/Fotango/Build-585/build/bin'
version:        1116    '5.8.5'
useithreads:    1002    undef
osvers: 982     '2.4.21-9.elhugemem'
osname: 851     'linux'
inc_version_list:       783     ' '
dont_use_nlink: 779     undef
intsize:        759     '4'
usevendorprefix:        642     undef
dlsrc:  624     'dl_dlopen.xs'
cc:     541     'cc'
lib_ext:        520     '.a'
so:     512     'so'
ld:     501     'cc'
ccdlflags:      500     '-Wl,-E'
ldflags:        495     ' -L/usr/local/lib'
obj_ext:        495     '.o'
cccdlflags:     493     '-fpic'
lddlflags:      493     '-shared -L/usr/local/lib'
ar:     492     'ar'
dlext:  492     'so'
libc:   492     '/lib/libc-2.3.2.so'
ranlib: 492     ':'
full_ar:        491     '/usr/bin/ar'
vendorarchexp:  491     ''
vendorlibexp:   491     ''
installman1dir: 489     '/home/nick/Fotango/Build-585/build/man/man1'
installman3dir: 489     '/home/nick/Fotango/Build-585/build/man/man3'
installsitebin: 489     '/home/nick/Fotango/Build-585/build/bin'
installsiteman1dir:     489     '/home/nick/Fotango/Build-585/build/man/man1'
installsiteman3dir:     489     '/home/nick/Fotango/Build-585/build/man/man3'
installvendorman1dir:   489     ''
installvendorman3dir:   489     ''
d_flexfnam:     474     'define'
eunicefix:      360     ':'
d_link: 347     'define'
installsitearch:        344     '/home/nick/Fotango/Build-585/build/lib/perl5/site_perl/5.8.5/i686-linux'
installscript:  341     '/home/nick/Fotango/Build-585/build/bin'
installprivlib: 337     '/home/nick/Fotango/Build-585/build/lib/perl5/5.8.5'

I think I'm going to put the numbers data for the top 100 into configpm, and
make it selectable how many it builds into the %Config cache, with its
default making the last included value 'dlsrc';

I've attached the analyser program.

Nicholas Clark

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About