From test-dev-return-3292-apmail-httpd-test-dev-archive=httpd.apache.org@httpd.apache.org Thu Sep 16 18:55:23 2004 Return-Path: Delivered-To: apmail-httpd-test-dev-archive@www.apache.org Received: (qmail 772 invoked from network); 16 Sep 2004 18:55:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 16 Sep 2004 18:55:23 -0000 Received: (qmail 2111 invoked by uid 500); 16 Sep 2004 18:54:55 -0000 Delivered-To: apmail-httpd-test-dev-archive@httpd.apache.org Received: (qmail 1859 invoked by uid 500); 16 Sep 2004 18:54:52 -0000 Mailing-List: contact test-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: test-dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list test-dev@httpd.apache.org Received: (qmail 1801 invoked by uid 99); 16 Sep 2004 18:54:51 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [66.34.202.202] (HELO minerva.ectoplasm.org) (66.34.202.202) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 16 Sep 2004 11:54:50 -0700 Received: from [172.28.57.123] (office4.tmcs.net [209.104.55.5]) by minerva.ectoplasm.org (Postfix) with ESMTP id 52D5F5EB1C; Thu, 16 Sep 2004 11:54:48 -0700 (PDT) Message-ID: <4149E17A.8020805@ectoplasm.org> Date: Thu, 16 Sep 2004 11:54:50 -0700 From: "Philippe M. Chiasson" User-Agent: Mozilla Thunderbird 0.8 (X11/20040913) X-Accept-Language: en-us, en MIME-Version: 1.0 To: test-dev@httpd.apache.org Cc: dev@perl.apache.org Subject: [Patch] Caching apxs queries Content-Type: multipart/mixed; boundary="------------050007010100080501000908" X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N --------------050007010100080501000908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050007010100080501000908 Content-Type: text/x-patch; name="apxs_cache.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="apxs_cache.patch" 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 -0000 1.244 +++ perl-framework/Apache-Test/lib/Apache/TestConfig.pm 16 Sep 2004 17:46:54 -0000 @@ -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 { --------------050007010100080501000908--