From: Sebastien Binet Date: Mon, 9 Jul 2012 17:04:45 +0000 (+0200) Subject: post-new [was: Re: query on a subset of messages ?] X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=e692faf692fa58c3632e5394c831ebde764b0368;p=notmuch-archives.git post-new [was: Re: query on a subset of messages ?] --- diff --git a/04/9b9c669b82532f1ab86493b678aaa175854bd2 b/04/9b9c669b82532f1ab86493b678aaa175854bd2 new file mode 100644 index 000000000..129237152 --- /dev/null +++ b/04/9b9c669b82532f1ab86493b678aaa175854bd2 @@ -0,0 +1,138 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 5C0C1431FD7 + for ; Mon, 9 Jul 2012 10:04:48 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -5 +X-Spam-Level: +X-Spam-Status: No, score=-5 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_HI=-5] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id 9SMI4FCexOWZ for ; + Mon, 9 Jul 2012 10:04:47 -0700 (PDT) +Received: from CERNMX32.cern.ch (cernmx32.cern.ch [137.138.144.178]) + (using TLSv1 with cipher AES128-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id 5A354431FAE + for ; Mon, 9 Jul 2012 10:04:47 -0700 (PDT) +Received: from CERNFE22.cern.ch (137.138.144.151) by cernmxgwlb2.cern.ch + (137.138.144.178) with Microsoft SMTP Server (TLS) id 14.2.283.3; + Mon, 9 Jul 2012 19:04:45 +0200 +Received: from localhost (134.158.88.68) by smtp.cern.ch (137.138.144.172) + with Microsoft SMTP Server (TLS) id 14.2.298.4; Mon, 9 Jul 2012 19:04:45 + +0200 +From: Sebastien Binet +To: Jameson Graef Rollins , Notmuch developer list + +Subject: post-new [was: Re: query on a subset of messages ?] +In-Reply-To: <87wr2c3mtj.fsf@cern.ch> +References: <871ukl5oj7.fsf@cern.ch> <87ehol2aku.fsf@servo.finestructure.net> + <87wr2c3mtj.fsf@cern.ch> +User-Agent: Notmuch/0.13.2+60~g7ecf77d (http://notmuchmail.org) Emacs/24.1.1 + (x86_64-unknown-linux-gnu) +Date: Mon, 9 Jul 2012 19:04:45 +0200 +Message-ID: <87r4sk3lxu.fsf@cern.ch> +MIME-Version: 1.0 +Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha1; + protocol="application/pgp-signature" +X-Originating-IP: [134.158.88.68] +Keywords: CERN SpamKiller Note: -50 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Mon, 09 Jul 2012 17:04:48 -0000 + +--=-=-= +Content-Type: text/plain +Content-Transfer-Encoding: quoted-printable + +Sebastien Binet writes: + +> Jamie, +> +> Jameson Graef Rollins writes: +> +>> On Mon, Jul 09 2012, Sebastien Binet wrote: +>>> I was trying to reduce the I/O stress during my usual email +>>> fetching+tagging by writing a little program using the go bindings to +>>> notmuch. +>>> +>>> ie: +>>> db, status :=3D notmuch.OpenDatabase(db_path, +>>> notmuch.DATABASE_MODE_READ_WRITE) +>>> query :=3D db.CreateQuery("(tag:new AND tag:inbox)") +>>> msgs :=3D query.SearchMessages() +>>> for _,msg :=3D range msgs { +>>> tag_msg(msg, tagqueries) +>>> } +>>> +>>> +>>> where tagqueries is a subquery of the form: +>>> [ +>>> { +>>> "Cmd": "+to-me", +>>> "Query": "(to:sebastien.binet@cern.ch and not tag:to-me)" +>>> }, +>>> { +>>> "Cmd": "+sci-notmuch", +>>> "Query": "from:notmuch@notmuchmail.org or to:notmuch@notmuchmai= +l.org or subject:notmuch" +>>> } +>>> ] +>> +>> +>> Hi, Sebastian. It's really hard for me to believe that this is much +>> faster than simply making the two tagging calls in full: +>> +>> notmuch tag +to-me -- tag:new and tag:inbox and (to:sebastien.binet@cern= +.ch and not tag:to-me) +>> notmuch tag +sci-notmuch -- tag:new and tag:inbox and from:notmuch@notmu= +chmail.org or to:notmuch@notmuchmail.org or subject:notmuch" +>> +>> After the first call the cache will be fresh, so the overhead should be +>> minimal. It looks to me you're looking in to this as a post-new hook. +>> I do pretty much the same thing, and with the above properly constructed +>> searches the tagging is super fast. +> +> well, of course I don't have just those two: +> +> $ grep -He "^tag_new " emacs/notmuch-lib/notmuch-tag.sh | wc -l +> 54 +> +> also: +> $ du -hs mail-notmuch/.notmuch=20 +> 2.9G mail-notmuch/.notmuch +> +> that said, most of the I/O wait seem to come from 'notmuch new' (after +> having dropped all fs caches.) +> +> ok, post-new hook it is then :) + +hum... is post-new supposed to be run even if there is no new message ? + +=2Ds + +--=-=-= +Content-Type: application/pgp-signature + +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.19 (GNU/Linux) + +iEYEARECAAYFAk/7Dy0ACgkQPj4AVbsZCCYbhwCfSIExENOQ3sNYfUkzdVwspDfg +ev4AoLw/UVxCscG9quFzyVpXv54h5kn8 +=fqLI +-----END PGP SIGNATURE----- +--=-=-=--