Re: [PATCH 3/4] Optimize thread search using matched docid sets.
authorAustin Clements <amdragon@MIT.EDU>
Wed, 8 Dec 2010 21:58:44 +0000 (16:58 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:37:39 +0000 (09:37 -0800)
68/bb03a74ffb37bc2aff3947163cef886037edf3 [new file with mode: 0644]

diff --git a/68/bb03a74ffb37bc2aff3947163cef886037edf3 b/68/bb03a74ffb37bc2aff3947163cef886037edf3
new file mode 100644 (file)
index 0000000..275202d
--- /dev/null
@@ -0,0 +1,117 @@
+Return-Path: <amdragon@mit.edu>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 56EE2431FB5\r
+       for <notmuch@notmuchmail.org>; Wed,  8 Dec 2010 13:58:48 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=unavailable\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id vWHQiZBRt-e7 for <notmuch@notmuchmail.org>;\r
+       Wed,  8 Dec 2010 13:58:48 -0800 (PST)\r
+Received: from dmz-mailsec-scanner-6.mit.edu (DMZ-MAILSEC-SCANNER-6.MIT.EDU\r
+       [18.7.68.35])\r
+       by olra.theworths.org (Postfix) with ESMTP id 29DFF431FB6\r
+       for <notmuch@notmuchmail.org>; Wed,  8 Dec 2010 13:58:48 -0800 (PST)\r
+X-AuditID: 12074423-b7bd0ae000000a00-92-4cffff970d62\r
+Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
+       by dmz-mailsec-scanner-6.mit.edu (Symantec Brightmail Gateway) with\r
+       SMTP id 92.47.02560.79FFFFC4; Wed,  8 Dec 2010 16:58:47 -0500 (EST)\r
+Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
+       by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id oB8Lwk2e000460; \r
+       Wed, 8 Dec 2010 16:58:46 -0500\r
+Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
+       (authenticated bits=0)\r
+       (User authenticated as amdragon@ATHENA.MIT.EDU)\r
+       by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id oB8LwieZ018638\r
+       (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
+       Wed, 8 Dec 2010 16:58:45 -0500 (EST)\r
+Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.72)\r
+       (envelope-from <amdragon@mit.edu>)\r
+       id 1PQS28-0001fb-D8; Wed, 08 Dec 2010 16:58:44 -0500\r
+Date: Wed, 8 Dec 2010 16:58:44 -0500\r
+From: Austin Clements <amdragon@MIT.EDU>\r
+To: Carl Worth <cworth@cworth.org>\r
+Subject: Re: [PATCH 3/4] Optimize thread search using matched docid sets.\r
+Message-ID: <20101208215844.GS2447@mit.edu>\r
+References: <20101117192826.GU2439@mit.edu>\r
+       <874oap5aek.fsf@yoom.home.cworth.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To: <874oap5aek.fsf@yoom.home.cworth.org>\r
+User-Agent: Mutt/1.5.20 (2009-06-14)\r
+X-Brightmail-Tracker: AAAAAA==\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 08 Dec 2010 21:58:48 -0000\r
+\r
+Quoth Carl Worth on Dec 07 at  5:19 pm:\r
+> On Wed, 17 Nov 2010 14:28:26 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
+> > This reduces thread search's 1+2t Xapian queries (where t is the\r
+> > number of matched threads) to 1+t queries and constructs exactly one\r
+> > notmuch_message_t for each message instead of 2 to 3.\r
+> \r
+> Fantastic stuff, Austin!\r
+> \r
+> I've merged this now, (sorry it took me a while to get to it).\r
+> \r
+> One of the reasons I didn't merge it immediately is that I wanted to\r
+> ensure that I understood the original author-ordering bug. Basically,\r
+> I'm inherently uncomfortable with a performance optimization that fixes\r
+> a bug as a side effect, (unless we understand that very well).\r
+> \r
+> So what I pushed actually adds the bug fix first, so that the\r
+> performance optimization makes no change at all to the test suite. That\r
+> feels better to me, (even though it simply demonstrated conclusively\r
+> that the bug was in a piece of code that was eliminated by the\r
+> optimization).\r
+\r
+Ah, good.  You are less lazy than I.\r
+\r
+> Anyway, in a quick reading of the code, the only little thing I saw was:\r
+> \r
+> > +    size_t count = (bound + sizeof (doc_ids->bitmap[0]) - 1) /\r
+> > +  sizeof (doc_ids->bitmap[0]);\r
+> \r
+> Which would look better to my eyes with a 1 factored out of the\r
+> division:\r
+> \r
+>      size_t count = 1 + (bound - 1) / sizeof (doc_ids->bitmap[0]);\r
+> \r
+> And the repeated use of "sizeof (doc_ids->bitmap[0])" could maybe do\r
+> with a macro for better legibility. Though it would be an evil macro if\r
+> it didn't accept an argument, and it wouldn't be much shorter if it\r
+> did. So maybe it's fine as-is.\r
+\r
+I found what I think is a cleaner way to write that bit of code.  A\r
+small patch is forthcoming.\r
+\r
+> Thanks for the optimization. Now all we need is a little notmuch\r
+> benchmark so that I can be sure not to regress any performance work with\r
+> my sloppy coding!\r
+\r
+Now that this is in (and I have a temporary respite from TA duties),\r
+I'm going to finish up and send out my other ~1.7X improvement, just\r
+to get it out of my queue.  Then I'll look at making a performance\r
+regression suite.  Were you thinking of some standard set of timed\r
+operations wrapped in a little script that can tell you if you've made\r
+things worse, or something more elaborate?\r
+\r
+Thanks for pushing these patches!\r