Re: Optimization for notmuch tag by implicit filters
authorPieter Praet <pieter@praet.org>
Wed, 27 Apr 2011 20:41:56 +0000 (22:41 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:08 +0000 (09:38 -0800)
d8/2f4533b2d1e6a3144758ad317b9d68496c2a4b [new file with mode: 0644]

diff --git a/d8/2f4533b2d1e6a3144758ad317b9d68496c2a4b b/d8/2f4533b2d1e6a3144758ad317b9d68496c2a4b
new file mode 100644 (file)
index 0000000..41f8700
--- /dev/null
@@ -0,0 +1,151 @@
+Return-Path: <pieter@praet.org>\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 32306431FD0\r
+       for <notmuch@notmuchmail.org>; Wed, 27 Apr 2011 13:42:01 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\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 DZwgzAVVnfnY for <notmuch@notmuchmail.org>;\r
+       Wed, 27 Apr 2011 13:42:00 -0700 (PDT)\r
+Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
+       [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 3B42C431FB5\r
+       for <notmuch@notmuchmail.org>; Wed, 27 Apr 2011 13:42:00 -0700 (PDT)\r
+Received: by wyi11 with SMTP id 11so1719783wyi.26\r
+       for <notmuch@notmuchmail.org>; Wed, 27 Apr 2011 13:41:59 -0700 (PDT)\r
+Received: by 10.216.144.134 with SMTP id n6mr2652419wej.27.1303936918949;\r
+       Wed, 27 Apr 2011 13:41:58 -0700 (PDT)\r
+Received: from localhost (202.69-240-81.adsl-dyn.isp.belgacom.be\r
+       [81.240.69.202])\r
+       by mx.google.com with ESMTPS id g46sm553242wes.40.2011.04.27.13.41.56\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 27 Apr 2011 13:41:58 -0700 (PDT)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Florian Friesdorf <flo@chaoflow.net>, notmuch@notmuchmail.org\r
+Subject: Re: Optimization for notmuch tag by implicit filters\r
+In-Reply-To: <87k4egu2ci.fsf@eve.chaoflow.net>\r
+References: <87y63d6y25.fsf@eve.chaoflow.net>\r
+       <87mxjqgxmx.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me>\r
+       <87k4egu2ci.fsf@eve.chaoflow.net>\r
+User-Agent: Notmuch/0.5-98-g63c37b1 (http://notmuchmail.org) Emacs/23.1.50.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Wed, 27 Apr 2011 22:41:56 +0200\r
+Message-ID: <87mxjb8m0b.fsf@praet.org>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\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, 27 Apr 2011 20:42:01 -0000\r
+\r
+On Tue, 26 Apr 2011 23:31:09 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:\r
+> On Sat, 16 Apr 2011 14:59:34 +0200, Pieter Praet <pieter@praet.org> wrote:\r
+> > On Thu, 14 Apr 2011 10:23:46 +0200, Florian Friesdorf <flo@chaoflow.net> wrote:\r
+> > > \r
+> > > With 60k messages and 12k tagged as sent:\r
+> > > \r
+> > > $ time notmuch tag +sent -- from:flo@chaoflow.net\r
+> > > \r
+> > > real     0m8.561s\r
+> > > user     0m8.069s\r
+> > > sys      0m0.212s\r
+> > > \r
+> > > $ time notmuch tag +sent -- from:flo@chaoflow.net and not tag:sent\r
+> > > \r
+> > > real     0m0.043s\r
+> > > user     0m0.036s\r
+> > > sys      0m0.006s\r
+> > > \r
+> > > \r
+> > > This could be made implicit:\r
+> > > \r
+> > > notmuch tag +A +B -- <filter>\r
+> > > -->\r
+> > > notmuch tag +A +B -- <filter> and not \(tag:A and tag:B\)\r
+> > > \r
+> > > Apply command, if one of the tags is not set.\r
+> > > \r
+> > > \r
+> > > notmuch tag -C -D -- <filter>\r
+> > > -->\r
+> > > notmuch tag -C -D -- <filter> and \(tag:C or tag:D\)\r
+> > > \r
+> > > Apply command, if one of the tags is set.\r
+> > > \r
+> > > \r
+> > > notmuch tag +A +B -C -D -- <filter>\r
+> > > -->\r
+> > > notmuch tag +A +B -C -D -- <filter> and \(not tag:A or not tag:B\ or tag:C or tag:D\)\r
+> \r
+> The second '\' after 'B' is not supposed to be there.\r
+> \r
+> > > In order to enforce tagging and disable the filter there could be a\r
+> > > flag.\r
+> > > \r
+> > > I lack the knowledge/time to implement it, but I think it's at least\r
+> > > worth documenting it.\r
+> > \r
+> > Most of us already do this explicitly in our tagging scripts, so no harm\r
+> > in making it standard behaviour, I guess.\r
+> > \r
+> > Though to keep the implementation nice & clean, I'd advise against the\r
+> > use of parens: no need for escape chars, no messing with De Morgan's\r
+> > law, simply map the tag operations to their inverse in conjunctively\r
+> > joined filters:\r
+> > \r
+> > notmuch tag +A +B -- <filter> and not tag:A or not tag:B\r
+> > notmuch tag -C -D -- <filter> and tag:C or tag:D\r
+> > notmuch tag +A +B -C -D -- <filter> and not tag:A or not tag:B or tag:C or tag:D\r
+> \r
+> I am not sure whether I understand what you mean.\r
+> \r
+> The parens are already supported by notmuch and also needed. Your second\r
+> line for example would remove C and D, if D is set, independently of\r
+> <filter>. Without parens, based on `and` taking precedence over `or`:\r
+> \r
+> F and (C or D) = F and C or F and D.\r
+> \r
+> -- \r
+> Florian Friesdorf <flo@chaoflow.net>\r
+>   GPG FPR: 7A13 5EEE 1421 9FC2 108D  BAAF 38F8 99A3 0C45 F083\r
+> Jabber/XMPP: flo@chaoflow.net\r
+> IRC: chaoflow on freenode,ircnet,blafasel,OFTC\r
+Non-text part: application/pgp-signature\r
+\r
+\r
+Correct.\r
+\r
+I wasn't taking the user-defined <filter> into consideration, which\r
+should indeed be conjunctive with the *entire* following expression.\r
+\r
+I was commenting on the use of parens *inside* our implicit filter,\r
+which was absolutely superfluous since you did no such thing. :D\r
+\r
+Also, I said "simply map the tag operations to their inverse in\r
+conjunctively joined filters", but what I meant was "DISjunctively\r
+joined filters".\r
+\r
+Perhaps I should go over my textbook on propositional logic again one\r
+of these days :)\r
+\r
+\r
+Peace\r
+\r
+-Pieter\r