perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <>
Subject Re: [mp2] speeding up perl Makefile.PL
Date Thu, 23 Dec 2004 22:48:50 GMT
Randy Kobes wrote:
> On an old (slow) machine I have, 'perl Makefile.PL'
> takes a long time. By inserting some debug statements:
>  sub apxs_cflags {
> -    my $cflags = __PACKAGE__->apxs('-q' => 'CFLAGS');
> +    my $self = shift;
> +    my $ref = ($self and ref($self) eq __PACKAGE__) ? $self : '';
> +    my $who = $ref ? $self : __PACKAGE__;
> +    my $cflags = $who->apxs('-q' => 'CFLAGS');

better written as:

my $who = ($self and ref($self) eq __PACKAGE__) ? $self : __PACKAGE__;

and of course as the same code is written twice, it's a candidate for a 

> which seems to minimize the calls to build_config(), and
> also seems to use the cached apxs calls more. There's a
> few things going on in this diff:
> - within ModPerl::BuildMM, call build_config() only
> if $build isn't defined;
> - in Apache::Build, change the apxs_cflags, etc to call
> apxs as a method on $self, if it was invoked this way, so
> that the value can be stuffed into $self;
> - in the apxs sub of Apache::Build, return
> $self->{$query_key} only if it's defined.
> On my slow machine, this speeds up 'perl Makefile.PL' by a
> factor of 4. However, I'm unsure of some of these,
> especially within ModPerl::BuildMM of avoiding the calls to
> build_config().

Looks good. One should be careful with caching though. We have a hell of 
problems with caching in A-T, when A-T is reconfigured. So as long as any 
of these tools never change their configuration during the same perl run, 
it should be fine. so in the future we might need a tool to kill the caches.

However please wait till gozer releases RC2 in a few hours before 
committing it. so we can give it a good testing.

p.s. A-T's config object needs a lot of rework too. At the moment things 
slow down a lot, every time that object is asked for (as it's not cached), 
but as mentioned it's *very* tricky to do the caching in A-T right.

Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker     mod_perl Guide --->

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message