develooper Front page | perl.perl5.porters | Postings from June 2002

Config.pm bloat (was Re: threads and use Config)

Thread Previous | Thread Next
From:
Nicholas Clark
Date:
June 28, 2002 06:15
Subject:
Config.pm bloat (was Re: threads and use Config)
Message ID:
20020628141048.Q5635@plum.flirble.org
On Wed, Jun 26, 2002 at 12:05:31AM +0200, Arthur Bergman wrote:
> Hi
> 
> Since Simon pointed out to me that both DynaLoader AND lib.pm C<use 
> Config> I have decided NOT to remove the dependency of Config.pm from 
> threads.pm.
> 
> Any sufficiently advanced perl program has with all probability 
> Config.pm included.
> 
> If you have a problem with Config.pm bloat, please fix Config.pm

Why does Config.pm use an (effectively) an embedded copy of config.sh?
I see that it has a config_sh method to return the entire verbatim config.sh,
but do that many programs use it?

Is the idea of the tied hash to reduce memory usage (don't build expensive
hash structures when a single scalar is far more compact)?
[I seem to remember Ilya Z being annoyed that a measurable proportion of
memory needed by 'use POSIX ...' was all the structures build for Exporter,
and I think he started working on a better tied hash implementation to allow
lazy construction of Exporter structures, and thereby reduce memory for the
common case of 'use POSIX;']

Or is it just a way to avoid parsing the config.sh file to build the hash
of all values at load time?

Considering that Config.pm is a pre-generated file, surely it would make
more sense either to

a: Write out perl code à la Data::Dumper to build a real hash straight off
   like any regular perl module

b: Still have a tied hash with keys built from a single scalar, but make the
   scalar much faster to pass (none of that messy choosing between '' or ""
   quoting)

either way, the literal config.sh could be implemented by putting that
scalar in (say) Config/config_sh.pm and using require to pull it in if
needed.

This would be a proposal for 5.9, and hopefully 5.8.1

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