[...]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.
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 http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
