perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Randy Kobes <ra...@theoryx5.uwinnipeg.ca>
Subject Re: [mp2] speeding up perl Makefile.PL
Date Thu, 23 Dec 2004 23:06:18 GMT
On Thu, 23 Dec 2004, Stas Bekman wrote:

> 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
> wrapper.

Thanks, Stas - I'll change that.

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

OK - I have to do some Christmas shopping anyway (I'm early
this year :) I'd also like to test this out on an external
package like apreq2, to make sure it doesn't introduce
new problems.

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

That's very true ...

-- 
best regards,
randy

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Mime
View raw message