[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#87176: marked as done (Probable large speed increase by using references more)



Your message dated Mon, 18 Nov 2002 22:02:10 -0500
with message-id <E18DyeQ-0008LJ-00@auric.debian.org>
and subject line Bug#87176: fixed in debbugs 2.4
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--------------------------------------
Received: (at submit) by bugs.debian.org; 23 Feb 2001 04:02:44 +0000
>From tgs@finbar.dyndns.org Thu Feb 22 22:02:44 2001
Return-path: <tgs@finbar.dyndns.org>
Received: from iplsin33-019.dsl.gtei.net (finbar.dyndns.org) [::ffff:4.3.33.19] 
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 14W9RL-0003d3-00; Thu, 22 Feb 2001 22:02:43 -0600
Received: from megafauna (megafauna.homenet [192.168.1.5])
	by finbar.dyndns.org (Postfix) with ESMTP
	id C1B87F583; Thu, 22 Feb 2001 23:02:41 -0500 (EST)
Received: by megafauna (Postfix, from userid 1000)
	id CA845BCC3; Thu, 22 Feb 2001 23:02:40 -0500 (EST)
From: Thomas Smith <tgs@finbar.dyndns.org>
To: Debian Bug Tracking System <submit@bugs.debian.org>
Subject: Probable large speed increase by using references more
X-Reportbug-Version: 1.14
X-Mailer: reportbug 1.14
Date: Thu, 22 Feb 2001 23:02:40 -0500
Message-Id: <20010223040240.CA845BCC3@megafauna>
Delivered-To: submit@bugs.debian.org

Package: debbugs
Version: N/A; checked out from cvs on 2001-02-22
Severity: normal

I believe that using references in the debbugs cgi code more often would
greatly increase its speed.  As a simple demonstration, here is a Benchmark of
two subroutines.  One is passed a reference to a hash, and one is passed the
hash itself.  These subroutines are typical of those used in the getbugs()
function.  Here's the code:

====Begin perl file====
#!/usr/bin/perl -w
use Benchmark qw(cmpthese);
sub withref {
        my ($hashref) = @_;
        return $$hashref{'b'} eq "woo";
}
sub withoutref {
        my %hash = @_;
        return $hash{'b'} eq "woo";
}
my %hash = ( "a" => "c", "b" => "woo", "c" => "bar" );
cmpthese( 100000, {
        "Sub passed Hash Ref." => sub { withref(\%hash ); 1;},
        "Sub passed Hash" => sub { withoutref(%hash ); 1;}
});
=====End perl file=====

And here are the results on my system:
Benchmark: timing 100000 iterations of Sub passed Hash, Sub passed Hash Ref....
Sub passed Hash: 14 wallclock secs (14.41 usr +  0.00 sys = 14.41 CPU) @ 6939.63/s (n=100000)
Sub passed Hash Ref.:  5 wallclock secs ( 4.87 usr +  0.00 sys =  4.87 CPU) @ 20533.88/s (n=100000)
                        Rate      Sub passed Hash Sub passed Hash Ref.
Sub passed Hash       6940/s                   --                 -66%
Sub passed Hash Ref. 20534/s                 196%                   --

In the test case, using the reference increased the speed by almost three
times.  I have done some implementation of this idea in the debbugs cgi area.
It is untested, as I don't have time to set up a working BTS and debug and
benchmark it.  Here is my patch to the version I got from CVS (generated with
cvs diff -u, suitable input for patch.):



Index: cgi/bugreport.cgi
===================================================================
RCS file: /cvs/debbugs/source/cgi/bugreport.cgi,v
retrieving revision 1.16
diff -u -r1.16 bugreport.cgi
--- cgi/bugreport.cgi	2001/02/18 14:33:37	1.16
+++ cgi/bugreport.cgi	2001/02/23 04:00:03
@@ -17,14 +17,14 @@
 
 my $tail_html;
 
-my %maintainer = getmaintainers();
+my %maintainer = %{getmaintainers()};
 
 my $ref = $param{'bug'} || quit("No bug number");
 my $msg = $param{'msg'} || "";
 my $boring = ($param{'boring'} || 'no') eq 'yes'; 
 my $reverse = ($param{'reverse'} || 'no') eq 'yes';
 
-my %status = getbugstatus($ref) or &quit("Couldn't get bug status: $!");
+my %status = %{getbugstatus($ref)} or &quit("Couldn't get bug status: $!");
 
 my $indexentry;
 my $descriptivehead;
Index: cgi/common.pl
===================================================================
RCS file: /cvs/debbugs/source/cgi/common.pl,v
retrieving revision 1.30
diff -u -r1.30 common.pl
--- cgi/common.pl	2001/02/20 10:17:15	1.30
+++ cgi/common.pl	2001/02/23 04:00:03
@@ -61,7 +61,7 @@
 
 sub htmlindexentry {
     my $ref = shift;
-    my %status = getbugstatus($ref);
+    my %status = %{getbugstatus($ref)};
     return htmlindexentrystatus(%status) if (%status);
     return "";
 }
@@ -204,7 +204,8 @@
 }
 
 sub htmlizebugs {
-    my @bugs = @_;
+    my $b = $_[0];
+    my @bugs = @$b;
 
     my %section = ();
 
@@ -217,7 +218,7 @@
     }
 
     foreach my $bug (sort {$a<=>$b} @bugs) {
-	my %status = getbugstatus($bug);
+	my %status = %{getbugstatus($bug)};
         next unless %status;
 	my @merged = sort {$a<=>$b} ($bug, split(/ /, $status{mergedwith}));
 	next unless ($common_repeatmerged || $bug == $merged[0]);
@@ -322,16 +323,17 @@
         }
         while(<I>) {
             if (m/^(\S+)\s+(\d+)\s+(\d+)\s+(\S+)\s+\[\s*([^]]*)\s*\]\s+(\w+)\s+(.*)$/) {
-                if ($bugfunc->(pkg => $1, bug => $2, status => $4, 
-                               submitter => $5, severity => $6, tags => $7))
-	        {
+	        my %hash = (pkg => $1, bug => $2, status => $4,
+		            submitter => $5, severity => $6, tags => $7);
+                if ($bugfunc->\%hash) {
 	       	    push (@result, $2);
 	        }
 	    }
         }
         close I;
     }
-    return sort {$a <=> $b} @result;
+    @result = sort {$a <=> $b} @result;
+    return \@result;
 }
 
 sub emailfromrfc822 {
@@ -371,7 +373,7 @@
     }
     close(MM);
 
-    return %maintainer;
+    return \%maintainer;
 }
 
 sub getbugstatus {
@@ -400,7 +402,7 @@
     $status{"pending"} = 'forwarded' if (length($status{"forwarded"}));
     $status{"pending"} = 'done'      if (length($status{"done"}));
 
-    return %status;
+    return \%status;
 }
 
 sub buglog {
Index: cgi/pkgindex.cgi
===================================================================
RCS file: /cvs/debbugs/source/cgi/pkgindex.cgi,v
retrieving revision 1.10
diff -u -r1.10 pkgindex.cgi
--- cgi/pkgindex.cgi	2001/02/18 14:33:37	1.10
+++ cgi/pkgindex.cgi	2001/02/23 04:00:04
@@ -32,7 +32,7 @@
 
 my $Archived = $archive ? "Archived" : "";
 
-my %maintainers = &getmaintainers();
+my %maintainers = %{&getmaintainers()};
 my %strings = ();
 
 $ENV{"TZ"} = 'UTC';
Index: cgi/pkgreport.cgi
===================================================================
RCS file: /cvs/debbugs/source/cgi/pkgreport.cgi,v
retrieving revision 1.26
diff -u -r1.26 pkgreport.cgi
--- cgi/pkgreport.cgi	2001/02/20 09:45:50	1.26
+++ cgi/pkgreport.cgi	2001/02/23 04:00:04
@@ -58,38 +58,38 @@
 my @bugs;
 if (defined $pkg) {
   $tag = "package $pkg";
-  @bugs = getbugs(sub {my %d=@_; return $pkg eq $d{"pkg"}}, 'package', $pkg);
+  @bugs = @{getbugs(sub {my %d=@{$_[0]}; return $pkg eq $d{"pkg"}}, 'package', $pkg)};
 } elsif (defined $maint) {
-  my %maintainers = getmaintainers();
+  my %maintainers = %{getmaintainers()};
   $tag = "maintainer $maint";
-  @bugs = getbugs(sub {my %d=@_; my $me; 
+  @bugs = @{getbugs(sub {my %d=@{$_[0]}; my $me; 
 		       ($me = $maintainers{$d{"pkg"}}||"") =~ s/\s*\(.*\)\s*//;
 		       $me = $1 if ($me =~ m/<(.*)>/);
 		       return $me eq $maint;
-		     })
+		     })};
 } elsif (defined $maintenc) {
-  my %maintainers = getmaintainers();
+  my %maintainers = %{getmaintainers()};
   $tag = "encoded maintainer $maintenc";
-  @bugs = getbugs(sub {my %d=@_; 
+  @bugs = @{getbugs(sub {my %d=@{$_[0]}; 
 		       return maintencoded($maintainers{$d{"pkg"}} || "") 
 			 eq $maintenc
-		       });
+		       })};
 } elsif (defined $submitter) {
   $tag = "submitter $submitter";
-  @bugs = getbugs(sub {my %d=@_; my $se; 
+  @bugs = @{getbugs(sub {my %d=@{$_[0]}; my $se; 
 		       ($se = $d{"submitter"} || "") =~ s/\s*\(.*\)\s*//;
 		       $se = $1 if ($se =~ m/<(.*)>/);
 		       return $se eq $submitter;
-		     }, 'submitter-email', $submitter);
+		     }, 'submitter-email', $submitter)};
 } elsif (defined $severity) {
   $tag = "$status $severity bugs";
-  @bugs = getbugs(sub {my %d=@_;
+  @bugs = @{getbugs(sub {my %d=@{$_[0]};
 		       return ($d{"severity"} eq $severity) 
 			 && ($d{"status"} eq $status);
-		     });
+		     })};
 }
 
-my $result = htmlizebugs(@bugs);
+my $result = ${htmlizebugs(\@bugs)};
 
 print "Content-Type: text/html\n\n";
 
@@ -103,7 +103,7 @@
       "</H1>\n";
 
 if (defined $pkg) {
-    my %maintainers = getmaintainers();
+    my %maintainers = %{getmaintainers()};
     if (defined $maintainers{$pkg}) {
         print "<p>Maintainer for $pkg is <a href=\"" 
               . mainturl($maintainers{$pkg}) . "\">"



-- System Information
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux megafauna 2.2.17 #3 SMP Thu Feb 1 22:13:11 EST 2001 i586


---------------------------------------
Received: (at 87176-close) by bugs.debian.org; 19 Nov 2002 03:08:39 +0000
>From katie@auric.debian.org Mon Nov 18 21:08:39 2002
Return-path: <katie@auric.debian.org>
Received: from auric.debian.org [206.246.226.45] (mail)
	by master.debian.org with esmtp (Exim 3.12 1 (Debian))
	id 18Dykg-0000Ax-00; Mon, 18 Nov 2002 21:08:38 -0600
Received: from katie by auric.debian.org with local (Exim 3.35 1 (Debian))
	id 18DyeQ-0008LJ-00; Mon, 18 Nov 2002 22:02:10 -0500
From: Colin Watson <cjwatson@debian.org>
To: 87176-close@bugs.debian.org
X-Katie: $Revision: 1.28 $
Subject: Bug#87176: fixed in debbugs 2.4
Message-Id: <E18DyeQ-0008LJ-00@auric.debian.org>
Sender: Archive Administrator <katie@auric.debian.org>
Date: Mon, 18 Nov 2002 22:02:10 -0500
Delivered-To: 87176-close@bugs.debian.org

We believe that the bug you reported is fixed in the latest version of
debbugs, which is due to be installed in the Debian FTP archive:

debbugs_2.4.dsc
  to pool/main/d/debbugs/debbugs_2.4.dsc
debbugs_2.4.tar.gz
  to pool/main/d/debbugs/debbugs_2.4.tar.gz
debbugs_2.4_all.deb
  to pool/main/d/debbugs/debbugs_2.4_all.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 87176@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Colin Watson <cjwatson@debian.org> (supplier of updated debbugs package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun, 17 Nov 2002 17:54:49 +0000
Source: debbugs
Binary: debbugs
Architecture: source all
Version: 2.4
Distribution: experimental
Urgency: low
Maintainer: Debbugs developers <debian-debbugs@lists.debian.org>
Changed-By: Colin Watson <cjwatson@debian.org>
Description: 
 debbugs    - The bug tracking system based on the active Debian BTS
Closes: 36813 78123 78688 86922 87176 93433 96164 113028 113514 121082 124537 146484 146745 152751
Changes: 
 debbugs (2.4) experimental; urgency=low
 .
   * Updating the package with what's in CVS, even though this might
     completely break things for people who've been using the previous also
     broken package. <shrug> :) Upped the minor version since the changes
     are noticeable, and uploaded to experimental, just in case.
   * Applied speedup patch, that uses references, instead of copies.
     Thanks to Thomas Smith. Closes: #87176. [Adam]
   * Reverted some parts of the speedup patch because it breaks the API.
     [Anthony]
   * Bugs that are tagged fixed are now listed in a separate section in the
     web pages. Patch from Colin Watson. Closes: #86922. [Adam]
   * Added support for an additional Maintainers.override file, which is read
     after the normal one. This allows the normal one to be externally
     updated, but still have local overrides. [Adam]
   * Put <title> and </title> on the same line as the title since some lame
     browsers don't seem to like it otherwise. [Josip]
   * Include a mailto: URI in the header for a bug report. [Adam]
   * Added support for filtering on subject with include=subj:foo (exact
     match, case sensitive). [Anthony]
   * Added a missing http://, thanks to Julian Gilbey. [Anthony]
   * Use by-*.idx indices to speed up pkgreport.cgi. [Anthony]
   * Support "maint=" in pkgreport to give packages without a maintainer.
     [Anthony]
   * Updated Postfix documentation. [Darren]
   * Use two variables in order to reduce the amount of path hard-coding.
   * Added support for storing the files in a hashed directory (db-h), with
     the same hash layout as archive/. [Adam]
   * Added support for tracing of bug state changes. This date is in
     $gSpoolDir/debbugs.trace. It is locked (as debbugs.trace.lock) while
     accessed, and appended to. Currently, nothing uses this trace file and
     it isn't even cleaned up, which can be easily fixed with a simple cron
     job. [Adam]
   * Tell sendmail to queue outgoing mail for later delivery, instead of
     immediate delivery. [Adam]
   * Added a keywords header to outgoing email responses. [Adam]
   * Use Resent-From: if From: doesn't exist. [Adam]
   * Added appropriate Reply-To: lines for the ACK messages that could use
     them. [Josip]
   * Add $gUnknownMaintainerEmail to the list of maintainers to mail in case
     an package with no maintainer is referenced. [Adam]
   * processall locks 'incoming-cleaner' before starting, so we don't have
     multiple copies of it running at the same time. [Adam]
   * Sort bugs tagged 'pending' as 'pending upload', between 'forwarded' and
     'fixed'. [Adam]
   * Add support for searching by source package.  pkgreport.cgi takes src=,
     and both pkgreport.cgi and bugreport.cgi have enhanced HTML headers now.
     [Adam]
   * Add support in the CGIs for:
     * 'raw' sorting. This does no grouping based on status or severity, and
       just lists bugs in number order.
     * reversing the order that bugs are displayed. This does not affect
       severity or status ordering.
     * inclusions/exclusions of status and severity. Also, support reverse
       sorting of the above.
   * Make it possible to ban people from control@bugs. [Anthony]
   * Don't lie about missing Subject:s being an RFC822 violation, because
     they aren't. [Anthony, Josip]
   * Added preliminary support for ###-request. [Adam]
   * Added preliminary fast indexing support. [Adam/Anthony (?)]
   * Added preliminary support for CC:ing <src>@packages.qa.debian.org.
     [Anthony]
   * Added preliminary cloning support. [Anthony]
   * Link to submitter's web page, patch from Matt Kraai. [Josip]
   * The autoconfig thing in the description is gone, closes: #124537.
   * Fix viewing archived bugs by source package, closes: #121082, #146484.
     [Colin]
   * Depends: libmailtools-perl rather than mailtools, closes: #113028.
   * Add MIME support to process and service, and depend on libmime-perl as a
     result, closes: #36813. [Colin]
   * Trim Bug#12345: from the Subject:, not "Bug#12345: [", closes: #78123.
     [Anthony]
   * Be more careful about loop detection, closes: #113514. [Adam, Colin]
   * Relax the syntax for 'tags' slightly, since people seem to use it that
     way accidentally a lot, closes: #96164. [Colin]
   * Give better feedback from pkgreport.cgi when querying a non-existent
     package name, closes: #93433. [Colin]
   * Remove support for -fixed address from receive, since nothing else
     supports it. [Colin]
   * Prevent people from reading the first line of arbitrary files through
     bugreport.cgi, thanks to Max <rusmir@tula.net>. [Colin]
   * Add working-for-me instructions for exim setup on non-dedicated sites,
     together with Chad Miller's suggestions, closes: #78688. [Colin]
   * Fix a few typos, closes: #146745, #152751.
   * Update the copyright file with the current list of maintainers and a
     pointer to ViewCVS.
   * Remove lynx-cfg, and use 'lynx -cfg=/dev/null' instead. [Colin]
   * Various other things, not worth mentioning here.
Files: 
 7ba22b1f545909aab56ff10afbf6b87d 681 misc optional debbugs_2.4.dsc
 9a005b52d95a91caa44c838ea22d2dd8 106528 misc optional debbugs_2.4.tar.gz
 964090007a7897b4c544869e0842b711 82204 misc optional debbugs_2.4_all.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
Comment: Colin Watson <cjwatson@debian.org> -- Debian developer

iD8DBQE92aJm9t0zAhD6TNERAuoHAJ94iNvCHOlWF8aNPA0ajSPrPYmpLQCggVO7
uJR+9m+UXelFyeQ0ichcoIA=
=qts9
-----END PGP SIGNATURE-----



Reply to: