[PATCH 4/4] Update NEWS for user.other_name
[notmuch-archives.git] / 8a / f3530b7e26dcc5a34bf90560825feaf26f908d
1 Return-Path: <pieter@praet.org>\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 C913A431FD0\r
6         for <notmuch@notmuchmail.org>; Sat, 16 Jul 2011 08:07:18 -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.69\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.69 tagged_above=-999 required=5\r
12         tests=[RCVD_IN_DNSWL_LOW=-0.7, T_MIME_NO_TEXT=0.01] 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 4itz8bn-Mnyi for <notmuch@notmuchmail.org>;\r
16         Sat, 16 Jul 2011 08:07:18 -0700 (PDT)\r
17 Received: from mail-wy0-f181.google.com (mail-wy0-f181.google.com\r
18         [74.125.82.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
19         (No client certificate requested)\r
20         by olra.theworths.org (Postfix) with ESMTPS id D65EE431FB6\r
21         for <notmuch@notmuchmail.org>; Sat, 16 Jul 2011 08:07:17 -0700 (PDT)\r
22 Received: by wyh22 with SMTP id 22so466768wyh.26\r
23         for <notmuch@notmuchmail.org>; Sat, 16 Jul 2011 08:07:16 -0700 (PDT)\r
24 Received: by 10.227.195.209 with SMTP id ed17mr4126119wbb.13.1310828836389;\r
25         Sat, 16 Jul 2011 08:07:16 -0700 (PDT)\r
26 Received: from localhost (130.40-242-81.adsl-dyn.isp.belgacom.be\r
27         [81.242.40.130])\r
28         by mx.google.com with ESMTPS id gd1sm1922019wbb.10.2011.07.16.08.07.14\r
29         (version=TLSv1/SSLv3 cipher=OTHER);\r
30         Sat, 16 Jul 2011 08:07:15 -0700 (PDT)\r
31 From: Pieter Praet <pieter@praet.org>\r
32 To: Austin Clements <amdragon@MIT.EDU>\r
33 Subject: Re: [PATCH v2] emacs: bad regexp @ `notmuch-search-process-filter'\r
34 In-Reply-To: <20110713185721.GI25558@mit.edu>\r
35 References: <20110705214234.GA15360@mit.edu>\r
36         <1310416993-31031-1-git-send-email-pieter@praet.org>\r
37         <20110711210532.GC25558@mit.edu> <878vs28dvo.fsf@praet.org>\r
38         <20110713185721.GI25558@mit.edu>\r
39 User-Agent: Notmuch/0.6-60-ga0910f1 (http://notmuchmail.org) Emacs/23.1.50.1\r
40         (x86_64-pc-linux-gnu)\r
41 Date: Sat, 16 Jul 2011 17:07:12 +0200\r
42 Message-ID: <87oc0u6z8f.fsf@praet.org>\r
43 MIME-Version: 1.0\r
44 Content-Type: multipart/mixed; boundary="=-=-="\r
45 Cc: Notmuch Mail <notmuch@notmuchmail.org>, David Edmondson <dme@dme.org>\r
46 X-BeenThere: notmuch@notmuchmail.org\r
47 X-Mailman-Version: 2.1.13\r
48 Precedence: list\r
49 List-Id: "Use and development of the notmuch mail system."\r
50         <notmuch.notmuchmail.org>\r
51 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
52         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
53 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
54 List-Post: <mailto:notmuch@notmuchmail.org>\r
55 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
56 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
57         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
58 X-List-Received-Date: Sat, 16 Jul 2011 15:07:18 -0000\r
59 \r
60 --=-=-=\r
61 \r
62 On Wed, 13 Jul 2011 14:57:21 -0400, Austin Clements <amdragon@MIT.EDU> wrote:\r
63 > Quoth Pieter Praet on Jul 13 at  4:16 pm:\r
64 > > On Mon, 11 Jul 2011 17:05:32 -0400, Austin Clements <amdragon@MIT.EDU> wrote:\r
65 > > > Quoth Pieter Praet on Jul 11 at 10:43 pm:\r
66 > > > > TL;DR: I can haz regex pl0x?\r
67 > > > \r
68 > > > Oof, what a pain.  I'm happy to change the output format of search; I\r
69 > > > hadn't realized how difficult it would be to parse.  In fact, I'm not\r
70 > > > sure it's even parsable by regexp, because the message ID's themselves\r
71 > > > could contain parens.\r
72 > > > \r
73 > > > So what would be a good format?  One possibility would be to\r
74 > > > NULL-delimit the query part; as distasteful as I find that, this part\r
75 > > > of the search output isn't meant for user consumption.  Though I fear\r
76 > > > this is endemic to the dual role the search output currently plays as\r
77 > > > both user and computer readable.\r
78 > > > \r
79 > > > I've also got the code to do everything using document ID's instead of\r
80 > > > message ID's.  As a side-effect, it makes the search output clean and\r
81 > > > readily parsable since document ID's are just numbers.  Hence, there\r
82 > > > are no quoting or escaping issues (plus the output is much more\r
83 > > > compact).  I haven't sent this to the list yet because I haven't had a\r
84 > > > chance to benchmark it and determine if the performance benefits make\r
85 > > > exposing document ID's worthwhile.\r
86 > > \r
87 > > Jamie Zawinski once said/wrote [1]:\r
88 > >   'Some people, when confronted with a problem, think "I know,\r
89 > >   I'll use regular expressions." Now they have two problems.'\r
90 > > \r
91 > > With this in mind, I set out to get rid of this whole regex mess altogether,\r
92 > > by populating the search buffer using Notmuch's JSON output instead of doing\r
93 > > brittle text matching tricks.\r
94 > > \r
95 > > Looking for some documentation, I stumbled upon a long-forgotten gem [2].\r
96 > > \r
97 > > David's already done pretty much all of the work for us!\r
98\r
99 > Yes, similar thoughts were running through my head as I futzed with\r
100 > the formatting for this.  My concern with moving to JSON for search\r
101 > buffers is that parsing it is about *30 times slower* than the current\r
102 > regexp-based approach (0.6 seconds versus 0.02 seconds for a mere 1413\r
103 > result search buffer).  I think JSON makes a lot of sense for show\r
104 > buffers because there's generally less data and it has a lot of\r
105 > complicated structure.  Search results, on the other hand, have a very\r
106 > simple, regular, and constrained structure, so JSON doesn't buy us\r
107 > nearly as much.\r
108 \r
109 That seems about right. Using the entire Notmuch mailing list archive,\r
110 processing JSON ends up taking 23x longer (see test in att).\r
111 \r
112 > JSON is hard to parse because, like the text search output, it's\r
113 > designed for human consumption (of course, unlike the text search\r
114 > output, it's also designed for computer consumption).  There's\r
115 > something to be said for the debuggability and generality of this and\r
116 > JSON is very good for exchanging small objects, but it's a remarkably\r
117 > inefficient way to exchange large amounts of data between two\r
118 > programs.\r
119\r
120 > I guess what I'm getting at, though it pains me to say it, is perhaps\r
121 > search needs a fast, computer-readable interchange format.  The\r
122 > structure of the data is so simple and constrained that this could be\r
123 > altogether trivial.\r
124 \r
125 I guess that's our only option then. Could you implement it for me?\r
126 I'll make sure to rebase my patch series in an acceptable time frame.\r
127 \r
128 An extra output format shouldn't be that much of a problem though, if we\r
129 further compartmentalize the code. What are your thoughts on (in the\r
130 long term) moving to a plugin-based architecture? Eg. enable something\r
131 like this:\r
132 \r
133   ./input/{Maildir, ...}\r
134   ./output/{plain, JSON, ...}\r
135   ./filters/{crypto, ...}\r
136   ./backends/(Xapian, ...)\r
137   ./uis/{Emacs, VIM, web, ...}\r
138 \r
139 > Or maybe I need a faster computer.\r
140 \r
141 That's what M$ Tech Support would want you to believe :)\r
142 What we need is slower computers, so devs are forced to count cycles again.\r
143 The rise of netbooks has thankfully done wonders in this respect.\r
144 \r
145 > If anyone is curious, here's how I timed the parsing.\r
146\r
147 > (defmacro time-it (code)\r
148 >   `(let ((start-time (get-internal-run-time)))\r
149 >      ,code\r
150 >      (float-time (time-subtract (get-internal-run-time) start-time))))\r
151\r
152 > (with-current-buffer "json"\r
153 >   (goto-char (point-min))\r
154 >   (time-it (json-read)))\r
155\r
156 > (with-current-buffer "text"\r
157 >   (goto-char (point-min))\r
158 >   (time-it\r
159 >    (while (re-search-forward "^\\(thread:[0-9A-Fa-f]*\\) \\([^][]*\\) \\(\\[[0-9/]*\\]\\) \\([^;]*\\); \\(.*\\) (\\([^()]*\\))$" nil t))))\r
160 \r
161 \r
162 Peace\r
163 \r
164 -- \r
165 Pieter\r
166 \r
167 --=-=-=\r
168 Content-Type: application/octet-stream\r
169 Content-Disposition: attachment; filename=regexp-vs-json.org\r
170 Content-Transfer-Encoding: base64\r
171 \r
172 KiBQYXJzaW5nIHBsYWluLXRleHQgdy8gcmVnZXhwIHZzLiBwYXJzaW5nIEpTT04uCgogICMrU09V\r
173 UkNFOiB0aW1lci1tYWNybwogICMrQkVHSU5fU1JDIGVtYWNzLWxpc3AKICAgIChkZWZtYWNybyB0\r
174 aW1lLWl0IChjb2RlKQogICAgICBgKGxldCAoKHN0YXJ0LXRpbWUgKGdldC1pbnRlcm5hbC1ydW4t\r
175 dGltZSkpKQogICAgICAgICAsY29kZQogICAgICAgICAoZmxvYXQtdGltZSAodGltZS1zdWJ0cmFj\r
176 dCAoZ2V0LWludGVybmFsLXJ1bi10aW1lKSBzdGFydC10aW1lKSkpKQogICMrRU5EX1NSQwoKICAj\r
177 K1NPVVJDRTogY291bnQtbXNncwogICMrQkVHSU5fU1JDIHNoCiAgICBub3RtdWNoIGNvdW50IC0t\r
178 IHRhZzp4L25vdG11Y2gKICAjK0VORF9TUkMKCiAgIytTT1VSQ0U6IHRpbWUtdGV4dAogICMrQkVH\r
179 SU5fU1JDIGVtYWNzLWxpc3AgOm5vd2ViIHllcwogICAgPDx0aW1lci1tYWNybz4+CiAgICAod2l0\r
180 aC10ZW1wLWJ1ZmZlcgogICAgICAoY2FsbC1wcm9jZXNzICJub3RtdWNoIiBuaWwgdCBuaWwgInNl\r
181 YXJjaCIgIi0tZm9ybWF0PXRleHQiICItLSIgInRhZzp4L25vdG11Y2giKQogICAgICAoZ290by1j\r
182 aGFyIChwb2ludC1taW4pKQogICAgICAodGltZS1pdAogICAgICAgKHdoaWxlIChyZS1zZWFyY2gt\r
183 Zm9yd2FyZCAiXlxcKHRocmVhZDpbMC05QS1GYS1mXSpcXCkgXFwoW15dW10qXFwpIFxcKFxcW1sw\r
184 LTkvXSpcXF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