Re: notmuch_thread_get_authors
authorAustin Clements <aclements@csail.mit.edu>
Wed, 22 Apr 2015 02:22:57 +0000 (22:22 +2000)
committerW. Trevor King <wking@tremily.us>
Sat, 20 Aug 2016 21:48:51 +0000 (14:48 -0700)
71/1de09bdf9c38f375728d25217672addb399dc9 [new file with mode: 0644]

diff --git a/71/1de09bdf9c38f375728d25217672addb399dc9 b/71/1de09bdf9c38f375728d25217672addb399dc9
new file mode 100644 (file)
index 0000000..440b208
--- /dev/null
@@ -0,0 +1,114 @@
+Return-Path: <aclements@csail.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 arlo.cworth.org (Postfix) with ESMTP id 4CA5B6DE1A32\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Apr 2015 19:23:02 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at cworth.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.21\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.21 tagged_above=-999 required=5 tests=[AWL=1.641, \r
+ RCVD_IN_DNSWL_MED=-2.3, RP_MATCHES_RCVD=-0.55, SPF_PASS=-0.001]\r
+ autolearn=disabled\r
+Received: from arlo.cworth.org ([127.0.0.1])\r
+ by localhost (arlo.cworth.org [127.0.0.1]) (amavisd-new, port 10024)\r
+ with ESMTP id QpuZJvg4tpVG for <notmuch@notmuchmail.org>;\r
+ Tue, 21 Apr 2015 19:23:00 -0700 (PDT)\r
+Received: from outgoing.csail.mit.edu (outgoing.csail.mit.edu [128.30.2.149])\r
+ by arlo.cworth.org (Postfix) with ESMTP id 03E316DE1A2E\r
+ for <notmuch@notmuchmail.org>; Tue, 21 Apr 2015 19:22:59 -0700 (PDT)\r
+Received: from [104.131.20.129] (helo=awakeningjr)\r
+ by outgoing.csail.mit.edu with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16)\r
+ (Exim 4.72) (envelope-from <aclements@csail.mit.edu>)\r
+ id 1YkkJW-0003TY-EU; Tue, 21 Apr 2015 22:22:58 -0400\r
+Received: from amthrax by awakeningjr with local (Exim 4.84)\r
+ (envelope-from <aclements@csail.mit.edu>)\r
+ id 1YkkJV-0007Se-E6; Tue, 21 Apr 2015 22:22:57 -0400\r
+Date: Tue, 21 Apr 2015 22:22:57 -0400\r
+From: Austin Clements <aclements@csail.mit.edu>\r
+To: Ronny Chevalier <chevalier.ronny@gmail.com>\r
+Subject: Re: notmuch_thread_get_authors\r
+Message-ID: <20150422022257.GN19324@csail.mit.edu>\r
+References:\r
+ <CABPZE7L5yX3tJH+1vMotxL7BHYoQd2BJSbzFuKTAxHgC5+6RHA@mail.gmail.com>\r
+ <87618qfk5l.fsf@maritornes.cs.unb.ca>\r
+ <CABPZE7JGzfSMWKpxKqJeCbpsDhX4xj_HoNoKFL8MbYv9xYpQ7w@mail.gmail.com>\r
+ <87lhhlhryd.fsf@csail.mit.edu>\r
+ <CABPZE7JSE-WwTGBNpYZuZSepG=TrQSsMx-C0e2vU+7PT50HLbQ@mail.gmail.com>\r
+MIME-Version: 1.0\r
+Content-Type: text/plain; charset=us-ascii\r
+Content-Disposition: inline\r
+In-Reply-To:\r
+ <CABPZE7JSE-WwTGBNpYZuZSepG=TrQSsMx-C0e2vU+7PT50HLbQ@mail.gmail.com>\r
+User-Agent: Mutt/1.5.23 (2014-03-12)\r
+Cc: notmuch@notmuchmail.org\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.18\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, 22 Apr 2015 02:23:02 -0000\r
+\r
+Quoth Ronny Chevalier on Apr 22 at  4:01 am:\r
+> On Wed, Apr 22, 2015 at 3:28 AM, Austin Clements\r
+> <aclements@csail.mit.edu> wrote:\r
+> > On Tue, 21 Apr 2015, Ronny Chevalier <chevalier.ronny@gmail.com> wrote:\r
+> >> On Tue, Apr 21, 2015 at 1:35 AM, David Bremner <david@tethera.net> wrote:\r
+> >>> Ronny Chevalier <chevalier.ronny@gmail.com> writes:\r
+> >> Austin Clements wrote:\r
+> >>> And I think there's a fairly easy way to do it in C code that will\r
+> >>> also prevent library interface bloat: instead of introducing new\r
+> >>> library APIs to get at this information, just use the existing\r
+> >>> notmuch_thread_get_messages API and construct the matched and\r
+> >>> non-matched lists in the CLI.  Doing it in the CLI wouldn't require\r
+> >>> the library to export yet another string list structure, which is\r
+> >>> always a huge pain (thanks C!), and wouldn't introduce more "helper"\r
+> >>> functions into the library API.\r
+> >>\r
+> >> I disagree with what Austin said. Because this does not solve the\r
+> >> issue at all (or I misunderstood). The issue is with the notmuch API,\r
+> >> if someone is using this library there no way it can parse properly\r
+> >> the authors.\r
+> >> In my case I am not using the CLI but the notmuch library, fixing this\r
+> >> in the CLI is just an hack, and it does not fix the issue for the\r
+> >> library users.\r
+> >\r
+> > My suggestion was in no way specific to the CLI. That was the context of\r
+> > the discussion at the time, but for the purposes of this discussion, the\r
+> > CLI is just another library user.\r
+> \r
+> Ok, sorry for misunderstanding.\r
+> \r
+> >\r
+> > You're completely right that there's no way to reliably parse the\r
+> > authors list returned by notmuch_thread_get_authors. So don't do\r
+> > that. Just use notmuch_thread_get_messages, walk the messages list, and\r
+> > build your own authors list. There's no need to introduce additional\r
+> > complexity and surface area into the library API for this specific use\r
+> > case (IMO, even notmuch_thread_get_authors shouldn't exist, but it's\r
+> > there for legacy reasons.) Then you can get author lists for matched,\r
+> > non-matched, matching a specific tag, just the to, just the from, counts\r
+> > of how many times each author appeared, whatever you want.\r
+> >\r
+> \r
+> Ok thanks!\r
+> \r
+> If I read the code correctly, _notmuch_thread_create in lib/thread.cc\r
+> process every message to get information like tags, subject and\r
+> authors. Since notmuch_thread_get_authors is here for legacy reasons,\r
+> would it be better to generate the list of authors only when requested\r
+> with notmuch_thread_get_authors (and cache the result of course)?\r
+> Because, new code will not use this and will do this work manually,\r
+> the generation of the list in intern consumes resources for nothing.\r
+\r
+It might be worth making this lazy. I'd be surprised if this has\r
+noticeable CPU or memory cost in the grand scheme of putting together\r
+a thread, but I don't have any numbers to back this up.\r