Re: Optimization for notmuch tag by implicit filters
authorPieter Praet <pieter@praet.org>
Sat, 16 Apr 2011 12:59:34 +0000 (14:59 +0200)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:38:04 +0000 (09:38 -0800)
74/a34dfea9d2f7a8909d67692831c4007dc3ede7 [new file with mode: 0644]

diff --git a/74/a34dfea9d2f7a8909d67692831c4007dc3ede7 b/74/a34dfea9d2f7a8909d67692831c4007dc3ede7
new file mode 100644 (file)
index 0000000..fe20b94
--- /dev/null
@@ -0,0 +1,126 @@
+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 4CD1C431FB6\r
+       for <notmuch@notmuchmail.org>; Sat, 16 Apr 2011 05:59:41 -0700 (PDT)\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=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 PL90WIdPy5VQ for <notmuch@notmuchmail.org>;\r
+       Sat, 16 Apr 2011 05:59:39 -0700 (PDT)\r
+Received: from mail-ww0-f41.google.com (mail-ww0-f41.google.com\r
+ [74.125.82.41])       (using TLSv1 with cipher RC4-SHA (128/128 bits))        (No client\r
+ certificate requested)        by olra.theworths.org (Postfix) with ESMTPS id\r
+ 410E4431FB5   for <notmuch@notmuchmail.org>; Sat, 16 Apr 2011 05:59:39 -0700\r
+ (PDT)\r
+Received: by wwi18 with SMTP id 18so432829wwi.2\r
+       for <notmuch@notmuchmail.org>; Sat, 16 Apr 2011 05:59:38 -0700 (PDT)\r
+Received: by 10.227.61.146 with SMTP id t18mr2981489wbh.189.1302958777837;\r
+       Sat, 16 Apr 2011 05:59:37 -0700 (PDT)\r
+Received: from localhost (99.28-240-81.adsl-dyn.isp.belgacom.be\r
+ [81.240.28.99])       by mx.google.com with ESMTPS id\r
+ bd8sm2157860wbb.48.2011.04.16.05.59.35        (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Sat, 16 Apr 2011 05:59:36 -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: <87y63d6y25.fsf@eve.chaoflow.net>\r
+References: <87y63d6y25.fsf@eve.chaoflow.net>\r
+User-Agent: Notmuch/0.5-86-g4875299 (http://notmuchmail.org) Emacs/23.1.50.1\r
+       (x86_64-pc-linux-gnu)\r
+Date: Sat, 16 Apr 2011 14:59:34 +0200\r
+Message-ID:\r
+ <87mxjqgxmx.fsf@A7GMS.i-did-not-set--mail-host-address--so-tickle-me>\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: Sat, 16 Apr 2011 12:59:41 -0000\r
+\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
+> \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
+> -- \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
+> notmuch mailing list\r
+> notmuch@notmuchmail.org\r
+> http://notmuchmail.org/mailman/listinfo/notmuch\r
+\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
+Peace\r
+\r
+-Pieter\r