1 Return-Path: <m.walters@qmul.ac.uk>
\r
2 X-Original-To: notmuch@notmuchmail.org
\r
3 Delivered-To: notmuch@notmuchmail.org
\r
4 Received: from localhost (localhost [127.0.0.1])
\r
5 by olra.theworths.org (Postfix) with ESMTP id 9AC3F431FB6
\r
6 for <notmuch@notmuchmail.org>; Sat, 7 Jul 2012 22:30:38 -0700 (PDT)
\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org
\r
11 X-Spam-Status: No, score=-1.098 tagged_above=-999 required=5
\r
12 tests=[DKIM_ADSP_CUSTOM_MED=0.001, FREEMAIL_FROM=0.001,
\r
13 NML_ADSP_CUSTOM_MED=1.2, RCVD_IN_DNSWL_MED=-2.3] autolearn=disabled
\r
14 Received: from olra.theworths.org ([127.0.0.1])
\r
15 by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)
\r
16 with ESMTP id hkw0yIYq79jM for <notmuch@notmuchmail.org>;
\r
17 Sat, 7 Jul 2012 22:30:38 -0700 (PDT)
\r
18 Received: from mail2.qmul.ac.uk (mail2.qmul.ac.uk [138.37.6.6])
\r
19 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
\r
20 (No client certificate requested)
\r
21 by olra.theworths.org (Postfix) with ESMTPS id D3952431FAE
\r
22 for <notmuch@notmuchmail.org>; Sat, 7 Jul 2012 22:30:37 -0700 (PDT)
\r
23 Received: from smtp.qmul.ac.uk ([138.37.6.40])
\r
24 by mail2.qmul.ac.uk with esmtp (Exim 4.71)
\r
25 (envelope-from <m.walters@qmul.ac.uk>)
\r
26 id 1Snk4l-0004hA-UI; Sun, 08 Jul 2012 06:30:32 +0100
\r
27 Received: from 94-192-233-223.zone6.bethere.co.uk ([94.192.233.223]
\r
29 by smtp.qmul.ac.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.69)
\r
30 (envelope-from <m.walters@qmul.ac.uk>)
\r
31 id 1Snk4l-0002bq-E5; Sun, 08 Jul 2012 06:30:31 +0100
\r
32 From: Mark Walters <markwalters1009@gmail.com>
\r
33 To: Austin Clements <amdragon@MIT.EDU>, Tomi Ollila <tomi.ollila@iki.fi>
\r
34 Subject: Re: [PATCH] cli: notmuch-show with framing newlines between threads
\r
36 In-Reply-To: <20120702035241.GD6220@mit.edu>
\r
37 References: <1341041024-5342-1-git-send-email-markwalters1009@gmail.com>
\r
38 <m24npr8701.fsf@guru.guru-group.fi>
\r
39 <20120702001215.GC6220@mit.edu> <20120702035241.GD6220@mit.edu>
\r
40 User-Agent: Notmuch/0.13.2+61~gf708609 (http://notmuchmail.org) Emacs/23.4.1
\r
41 (x86_64-pc-linux-gnu)
\r
42 Date: Sun, 08 Jul 2012 06:30:28 +0100
\r
43 Message-ID: <87ehomu8ej.fsf@qmul.ac.uk>
\r
45 Content-Type: text/plain; charset=us-ascii
\r
46 X-Sender-Host-Address: 94.192.233.223
\r
47 X-QM-SPAM-Info: Sender has good ham record. :)
\r
48 X-QM-Body-MD5: 41df64e922ed6acb98993a710cf53d02 (of first 20000 bytes)
\r
49 X-SpamAssassin-Score: -1.8
\r
50 X-SpamAssassin-SpamBar: -
\r
51 X-SpamAssassin-Report: The QM spam filters have analysed this message to
\r
53 spam. We require at least 5.0 points to mark a message as spam.
\r
54 This message scored -1.8 points.
\r
55 Summary of the scoring:
\r
56 * -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at http://www.dnswl.org/,
\r
58 * [138.37.6.40 listed in list.dnswl.org]
\r
59 * 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail
\r
60 provider * (markwalters1009[at]gmail.com)
\r
61 * -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay
\r
63 * 0.5 AWL AWL: From: address is in the auto white-list
\r
64 X-QM-Scan-Virus: ClamAV says the message is clean
\r
65 Cc: notmuch@notmuchmail.org
\r
66 X-BeenThere: notmuch@notmuchmail.org
\r
67 X-Mailman-Version: 2.1.13
\r
69 List-Id: "Use and development of the notmuch mail system."
\r
70 <notmuch.notmuchmail.org>
\r
71 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,
\r
72 <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>
\r
73 List-Archive: <http://notmuchmail.org/pipermail/notmuch>
\r
74 List-Post: <mailto:notmuch@notmuchmail.org>
\r
75 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>
\r
76 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,
\r
77 <mailto:notmuch-request@notmuchmail.org?subject=subscribe>
\r
78 X-List-Received-Date: Sun, 08 Jul 2012 05:30:38 -0000
\r
80 On Mon, 02 Jul 2012, Austin Clements <amdragon@MIT.EDU> wrote:
\r
81 > Quoth myself on Jul 01 at 8:12 pm:
\r
82 >> Quoth Tomi Ollila on Jul 02 at 1:13 am:
\r
83 >> > On Sat, Jun 30 2012, Mark Walters <markwalters1009@gmail.com> wrote:
\r
85 >> > > Add newlines between complete threads to make asynchronous parsing
\r
86 >> > > of the JSON easier.
\r
89 >> > > notmuch-pick uses the JSON output of notmuch show but, in many cases,
\r
90 >> > > for many threads. This can take quite a long time when displaying a
\r
91 >> > > large number of messages (say 20 seconds for the 10,000 messages in
\r
92 >> > > the notmuch archive). Thus it is desirable to display results
\r
93 >> > > incrementally in the same way that search currently does.
\r
95 >> > > To make this easier this patch adds newlines between each toplevel
\r
96 >> > > thread. So the ouput becomes
\r
103 >> > > , last_thread
\r
106 >> > > Thus the parser can easily tell if it has enough data to do some more
\r
109 >> > > Obviously, this changes the JSON output. This should not break any
\r
110 >> > > consumer as the JSON parsers should not mind. However, it does break
\r
111 >> > > several tests. Obviously, I will fix these but I wanted to check if
\r
112 >> > > people were basically happy with the change first.
\r
114 >> > To provide this feature rather than relying on newlines the parser should
\r
115 >> > use it's state to notice when one thread ends.
\r
117 >> > Such a change could be used (privately) for human consumption -- allowing
\r
118 >> > free change of whitespace during inspection (in a debugging session or so).
\r
119 >> > Computer software should not rely (or suffer) from any additional
\r
120 >> > (or lack thereof) whitespace there is...
\r
122 >> > ... or at least a really convicing argument for the chance needs to
\r
123 >> > be presented (before "restricting" the json output notmuch spits out).
\r
125 >> Given a JSON parser that only knows how to parse complete JSON
\r
126 >> expressions, it's potentially very inefficient to keep attempting to
\r
127 >> parse something when you don't know if it's complete. The newlines
\r
128 >> provide an in-band framing so the consumer knows when there's a
\r
129 >> complete object to be parsed.
\r
131 >> In effect, this defines a super-protocol of JSON that's compatible
\r
132 >> with standard JSON, but easy to incrementally parse.
\r
134 >> That said, just this weekend I implemented JSON-based search with
\r
135 >> incremental JSON parsing and I took a slightly different approach. I
\r
136 >> still put framing into the newlines of the search results, but rather
\r
137 >> than rely on it for correctness, the consumer uses it as an
\r
138 >> optimization that only hints that a complete JSON expression is
\r
139 >> probably available. If the expression turns out to be incomplete,
\r
142 >> I considered building a fully-incremental JSON parser that never
\r
143 >> backtracks by more than a token, which would eliminate even the cost
\r
144 >> of reparsing, but if we do move to S-expressions (which I think we
\r
145 >> should), we want to let Emacs' C implementation do as much of the
\r
146 >> parsing as possible, and the only thing we can do with that is read a
\r
147 >> complete expression.
\r
149 > Actually, I take that back. While we can't do fast incremental
\r
150 > S-expression parsing, `parse-partial-sexp' can tell us incrementally
\r
151 > (and probably very quickly) *if* there's a complete expression ready
\r
152 > to parse, so we could avoid calling into the parser at all unless it
\r
155 > I'll try this out in my incremental JSON parser and see how well it
\r
158 I have converted pick to use Austin's incremental parser and all works
\r
159 well so this seems the way to go. Hence I have marked my original patch
\r