I had been investigating into ways to make test runs run faster, and I found
that
one of the biggest bottlenecks on my test machine was useless repetitive calls
to apxs. The following patch caches apxs queries.
For instance, timings for mod_perl test run:
+ Before:
Files=218, Tests=2512, 1032 wallclock secs (594.94 cusr + 431.33 csys = 1026.27
CPU)
+ After:
Files=218, Tests=2512, 246 wallclock secs (196.69 cusr + 33.55 csys = 230.24
CPU)
--
Philippe M. Chiasson m/gozer\@(apache|cpan|ectoplasm)\.org/ GPG KeyID : 88C3A5A5
http://gozer.ectoplasm.org/ F9BF E0C2 480E 7680 1AE5 3631 CB32 A107 88C3A5A5
Index: perl-framework/Apache-Test/lib/Apache/TestConfig.pm
===
RCS file: /home/cvs/httpd-test/perl-framework/Apache-Test/lib/Apache/TestConfig.pm,v
retrieving revision 1.244
diff -u -I$Id -r1.244 TestConfig.pm
--- perl-framework/Apache-Test/lib/Apache/TestConfig.pm 5 Sep 2004 16:30:30 - 1.244
+++ perl-framework/Apache-Test/lib/Apache/TestConfig.pm 16 Sep 2004 17:46:54 -
@@ -1620,20 +1620,27 @@
sub apxs {
my($self, $q, $ok_fail) = @_;
return unless $self-{APXS};
-local @ENV{ qw(PATH IFS CDPATH ENV BASH_ENV) };
-my $devnull = devnull();
-my $apxs = shell_ready($self-{APXS});
-my $val = qx($apxs -q $q 2$devnull);
-chomp $val if defined $val; # apxs post-2.0.40 adds a new line
-unless ($val) {
-if ($ok_fail) {
-return ;
+my $val;
+unless (exists $self-{_apxs}{$q}) {
+local @ENV{ qw(PATH IFS CDPATH ENV BASH_ENV) };
+my $devnull = devnull();
+my $apxs = shell_ready($self-{APXS});
+$val = qx($apxs -q $q 2$devnull);
+chomp $val if defined $val; # apxs post-2.0.40 adds a new line
+if ($val) {
+$self-{_apxs}{$q} = $val;
}
-else {
-warn APXS ($self-{APXS}) query for $q failed\n;
+unless ($val) {
+if ($ok_fail) {
+return ;
+}
+else {
+warn APXS ($self-{APXS}) query for $q failed\n;
+return $val;
+}
}
}
-$val;
+$self-{_apxs}{$q};
}
sub pop_dir {