Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Perl: porters

getting Config.pm on a diet

 

 

Perl porters RSS feed   Index | Next | Previous | View Threaded


nick at ccl4

Nov 26, 2004, 12:58 PM

Post #1 of 4 (428 views)
Permalink
getting Config.pm on a diet

I have this patch (the sort that won't fit into the margin of this e-mail)
that cuts Config.pm down from about 32K to 3K by putting all the little used
stuff in another file. With my patch I have configpm generating the two files.

However, I have a problem, in that I don't know how to make the right rule
for VMS to describe the dependencies and the necessary copying. In a Unix
makefile a dependency such as

foo bar: ...
...

is the right way to specify that this rule builds both. What's the VMS
equivalent to:

lib/Config.pm lib/Config_heavy.pl: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
$(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl configpm.tmp
sh mv-if-diff configpm.tmp $@


Nicholas Clark


craigberry at mac

Nov 26, 2004, 2:26 PM

Post #2 of 4 (408 views)
Permalink
Re: getting Config.pm on a diet [In reply to]

At 8:58 PM +0000 11/26/04, Nicholas Clark wrote:
>I have this patch (the sort that won't fit into the margin of this e-mail)
>that cuts Config.pm down from about 32K to 3K by putting all the little used
>stuff in another file. With my patch I have configpm generating the two files.
>
>However, I have a problem, in that I don't know how to make the right rule
>for VMS to describe the dependencies and the necessary copying. In a Unix
>makefile a dependency such as
>
>foo bar: ...
> ...
>
>is the right way to specify that this rule builds both. What's the VMS
>equivalent to:
>
>lib/Config.pm lib/Config_heavy.pl: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
> $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl configpm.tmp
> sh mv-if-diff configpm.tmp $@

Multiple targets are allowed -- it just expands it into two separate
dependencies that are identical except for the target. So something
like the following oughta work:

[.lib]Config.pm [.lib]Config_heavy.pl : config.sh $(MINIPERL_EXE) configpm [.Porting]Glossary
$(MINIPERL) configpm --heavy=[.lib]Config_heavy.pl configpm.tmp
BACKUP/REPLACE/DELETE configpm.tmp $(MMS$TARGET)

We could get fancier with the mv, but I don't know exactly what
mv-if-diff does. Will it update the timestamp on the target even if
it doesn't need to do the move? Is it important that the timestamp
on lib/Config.pm *not* be updated unless the move actually took place?
--
________________________________________
Craig A. Berry
mailto:craigberry[at]mac.com

"... getting out of a sonnet is much more
difficult than getting in."
Brad Leithauser


nick at ccl4

Nov 27, 2004, 9:28 AM

Post #3 of 4 (407 views)
Permalink
Re: getting Config.pm on a diet [In reply to]

On Fri, Nov 26, 2004 at 04:26:24PM -0600, Craig A. Berry wrote:
> At 8:58 PM +0000 11/26/04, Nicholas Clark wrote:

> >is the right way to specify that this rule builds both. What's the VMS
> >equivalent to:
> >
> >lib/Config.pm lib/Config_heavy.pl: config.sh miniperl$(EXE_EXT) configpm Porting/Glossary
> > $(LDLIBPTH) ./miniperl -Ilib configpm --heavy=lib/Config_heavy.pl configpm.tmp
> > sh mv-if-diff configpm.tmp $@
>
> Multiple targets are allowed -- it just expands it into two separate
> dependencies that are identical except for the target. So something
> like the following oughta work:

Thanks. Hopefully I got all the editing right in change 23554
( http://public.activestate.com/cgi-bin/perlbrowse?patch=23554 )

Unfortunately the testdrive systems seem to be unreachable, so I couldn't
actually test anything.

> We could get fancier with the mv, but I don't know exactly what
> mv-if-diff does. Will it update the timestamp on the target even if
> it doesn't need to do the move? Is it important that the timestamp
> on lib/Config.pm *not* be updated unless the move actually took place?

Oops. I wasn't clear. That was based closely on the existing section of the
Unix Makefile. I'd not checked carefully enough to see what VMS was doing
for that step. It's only Unix that's doing that mv-if-diff

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

Nicholas Clark


nick at ccl4

Nov 27, 2004, 2:29 PM

Post #4 of 4 (398 views)
Permalink
Re: getting Config.pm on a diet [In reply to]

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
Attachments: CPanalyser (0.34 KB)

Perl porters RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.