Re: [PATCH v2] Omit User-Agent: header by default
[notmuch-archives.git] / 59 / e08b565eb2d97891bde2be9772ca8fceee8fbc
1 Return-Path: <amdragon@mit.edu>\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 4BF5A431FBC\r
6         for <notmuch@notmuchmail.org>; Sun,  1 Jul 2012 20:52:48 -0700 (PDT)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.7\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 5zw4IQ-ybvPT for <notmuch@notmuchmail.org>;\r
16         Sun,  1 Jul 2012 20:52:47 -0700 (PDT)\r
17 Received: from dmz-mailsec-scanner-4.mit.edu (DMZ-MAILSEC-SCANNER-4.MIT.EDU\r
18         [18.9.25.15])\r
19         by olra.theworths.org (Postfix) with ESMTP id 953E3431FAF\r
20         for <notmuch@notmuchmail.org>; Sun,  1 Jul 2012 20:52:47 -0700 (PDT)\r
21 X-AuditID: 1209190f-b7f306d0000008b4-a8-4ff11b0d0601\r
22 Received: from mailhub-auth-1.mit.edu ( [18.9.21.35])\r
23         by dmz-mailsec-scanner-4.mit.edu (Symantec Messaging Gateway) with SMTP\r
24         id C5.01.02228.D0B11FF4; Sun,  1 Jul 2012 23:52:46 -0400 (EDT)\r
25 Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103])\r
26         by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id q623qjul011592; \r
27         Sun, 1 Jul 2012 23:52:45 -0400\r
28 Received: from awakening.csail.mit.edu (awakening.csail.mit.edu [18.26.4.91])\r
29         (authenticated bits=0)\r
30         (User authenticated as amdragon@ATHENA.MIT.EDU)\r
31         by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id q623qgRi023541\r
32         (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NOT);\r
33         Sun, 1 Jul 2012 23:52:44 -0400 (EDT)\r
34 Received: from amthrax by awakening.csail.mit.edu with local (Exim 4.77)\r
35         (envelope-from <amdragon@MIT.EDU>)\r
36         id 1SlXgn-0007kM-VK; Sun, 01 Jul 2012 23:52:42 -0400\r
37 Date: Sun, 1 Jul 2012 23:52:41 -0400\r
38 From: Austin Clements <amdragon@MIT.EDU>\r
39 To: Tomi Ollila <tomi.ollila@iki.fi>\r
40 Subject: Re: [PATCH] cli: notmuch-show with framing newlines between threads\r
41         in JSON.\r
42 Message-ID: <20120702035241.GD6220@mit.edu>\r
43 References: <1341041024-5342-1-git-send-email-markwalters1009@gmail.com>\r
44         <m24npr8701.fsf@guru.guru-group.fi> <20120702001215.GC6220@mit.edu>\r
45 MIME-Version: 1.0\r
46 Content-Type: text/plain; charset=us-ascii\r
47 Content-Disposition: inline\r
48 In-Reply-To: <20120702001215.GC6220@mit.edu>\r
49 User-Agent: Mutt/1.5.21 (2010-09-15)\r
50 X-Brightmail-Tracker:\r
51  H4sIAAAAAAAAA+NgFprAKsWRmVeSWpSXmKPExsUixCmqrMsn/dHfYONdRovrN2cyW7xZOY/V\r
52         gcnj8NeFLB7PVt1iDmCK4rJJSc3JLEst0rdL4Mr4t0KioFW6YmrfJtYGxmmiXYycHBICJhJz\r
53         Nl5ngrDFJC7cW8/WxcjFISSwj1Fi8ckFrBDOekaJ04+nMUI4J5gkZr/fBuUsYZTYfvoDO0g/\r
54         i4CKxPnG32Cz2AQ0JLbtX84IYosAxR+0rWcFsZkFpCW+/W4GqxEWCJc4vGkLG4jNK6AtsW3u\r
55         exaIoRMYJSa9nMkKkRCUODnzCQtEs5bEjX8vgZo5wAYt/8cBEuYU0JHY3rwR7AZRoF1TTm5j\r
56         m8AoNAtJ9ywk3bMQuhcwMq9ilE3JrdLNTczMKU5N1i1OTszLSy3SNdHLzSzRS00p3cQIDmxJ\r
57         /h2M3w4qHWIU4GBU4uFVuv3BX4g1say4MvcQoyQHk5Io70qJj/5CfEn5KZUZicUZ8UWlOanF\r
58         hxglOJiVRHifHn/vL8SbklhZlVqUD5OS5mBREue9mnLTX0ggPbEkNTs1tSC1CCYrw8GhJMEb\r
59         LQU0VLAoNT21Ii0zpwQhzcTBCTKcB2j4apAa3uKCxNzizHSI/ClGXY51b47cYBRiycvPS5US\r
60         550FUiQAUpRRmgc3B5aQXjGKA70lzOsBUsUDTGZwk14BLWECWvJ89TuQJSWJCCmpBkbWoCOz\r
61         mc4khVzg6nbuYPLmejA3pJrbyS/WebJQ46mpl9RWfA7avVTQOl40PFD54VOD0Ef7k6TWrfvz\r
62         Qu2+bdZ/1mePQySnB35/tOlK5J17Tv5Ff03fWbS1iSbNCZtu6HhCfk6XXdIaD7XzffeTHh1q\r
63         Zip82GR20nBbl9SnfCE1gdKZRSvio5VYijMSDbWYi4oTARR0Lx8jAwAA\r
64 Cc: notmuch@notmuchmail.org\r
65 X-BeenThere: notmuch@notmuchmail.org\r
66 X-Mailman-Version: 2.1.13\r
67 Precedence: list\r
68 List-Id: "Use and development of the notmuch mail system."\r
69         <notmuch.notmuchmail.org>\r
70 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
71         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
72 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
73 List-Post: <mailto:notmuch@notmuchmail.org>\r
74 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
75 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
76         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
77 X-List-Received-Date: Mon, 02 Jul 2012 03:52:48 -0000\r
78 \r
79 Quoth myself on Jul 01 at  8:12 pm:\r
80 > Quoth Tomi Ollila on Jul 02 at  1:13 am:\r
81 > > On Sat, Jun 30 2012, Mark Walters <markwalters1009@gmail.com> wrote:\r
82 > > \r
83 > > > Add newlines between complete threads to make asynchronous parsing\r
84 > > > of the JSON easier.\r
85 > > > ---\r
86 > > >\r
87 > > > notmuch-pick uses the JSON output of notmuch show but, in many cases,\r
88 > > > for many threads. This can take quite a long time when displaying a\r
89 > > > large number of messages (say 20 seconds for the 10,000 messages in\r
90 > > > the notmuch archive). Thus it is desirable to display results\r
91 > > > incrementally in the same way that search currently does.\r
92 > > >\r
93 > > > To make this easier this patch adds newlines between each toplevel\r
94 > > > thread. So the ouput becomes\r
95 > > >\r
96 > > > [\r
97 > > > thread1\r
98 > > > , thread2\r
99 > > > , thread3\r
100 > > > ...\r
101 > > > , last_thread\r
102 > > > ]\r
103 > > >\r
104 > > > Thus the parser can easily tell if it has enough data to do some more\r
105 > > > parsing.\r
106 > > >\r
107 > > > Obviously, this changes the JSON output. This should not break any\r
108 > > > consumer as the JSON parsers should not mind. However, it does break\r
109 > > > several tests. Obviously, I will fix these but I wanted to check if\r
110 > > > people were basically happy with the change first.\r
111 > > \r
112 > > To provide this feature rather than relying on newlines the parser should\r
113 > > use it's state to notice when one thread ends. \r
114 > > \r
115 > > Such a change could be used (privately) for human consumption -- allowing \r
116 > > free change of whitespace during inspection (in a debugging session or so).\r
117 > > Computer software should not rely (or suffer) from any additional\r
118 > > (or lack thereof) whitespace there is...\r
119 > > \r
120 > > ... or at least a really convicing argument for the chance needs to\r
121 > > be presented (before "restricting" the json output notmuch spits out).\r
122\r
123 > Given a JSON parser that only knows how to parse complete JSON\r
124 > expressions, it's potentially very inefficient to keep attempting to\r
125 > parse something when you don't know if it's complete.  The newlines\r
126 > provide an in-band framing so the consumer knows when there's a\r
127 > complete object to be parsed.\r
128\r
129 > In effect, this defines a super-protocol of JSON that's compatible\r
130 > with standard JSON, but easy to incrementally parse.\r
131\r
132 > That said, just this weekend I implemented JSON-based search with\r
133 > incremental JSON parsing and I took a slightly different approach.  I\r
134 > still put framing into the newlines of the search results, but rather\r
135 > than rely on it for correctness, the consumer uses it as an\r
136 > optimization that only hints that a complete JSON expression is\r
137 > probably available.  If the expression turns out to be incomplete,\r
138 > that's okay.\r
139\r
140 > I considered building a fully-incremental JSON parser that never\r
141 > backtracks by more than a token, which would eliminate even the cost\r
142 > of reparsing, but if we do move to S-expressions (which I think we\r
143 > should), we want to let Emacs' C implementation do as much of the\r
144 > parsing as possible, and the only thing we can do with that is read a\r
145 > complete expression.\r
146 \r
147 Actually, I take that back.  While we can't do fast incremental\r
148 S-expression parsing, `parse-partial-sexp' can tell us incrementally\r
149 (and probably very quickly) *if* there's a complete expression ready\r
150 to parse, so we could avoid calling into the parser at all unless it\r
151 would succeed.\r
152 \r
153 I'll try this out in my incremental JSON parser and see how well it\r
154 works.\r