Re: [PATCH] emacs: wash: make word-wrap bound message width
[notmuch-archives.git] / b6 / 85c210328d16c5f63bb3a10028eeea2e93a45b
1 Return-Path: <jani@nikula.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 CA487431FBC\r
6         for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 09:22:04 -0800 (PST)\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 13B7HNzYy+OP for <notmuch@notmuchmail.org>;\r
16         Mon, 21 Jan 2013 09:22:03 -0800 (PST)\r
17 Received: from mail-bk0-f43.google.com (mail-bk0-f43.google.com\r
18         [209.85.214.43]) (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 7840D431FAF\r
21         for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 09:22:03 -0800 (PST)\r
22 Received: by mail-bk0-f43.google.com with SMTP id jf20so3233002bkc.2\r
23         for <notmuch@notmuchmail.org>; Mon, 21 Jan 2013 09:22:00 -0800 (PST)\r
24 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;\r
25         d=google.com; s=20120113;\r
26         h=x-received:from:to:subject:in-reply-to:references:user-agent:date\r
27         :message-id:mime-version:content-type:x-gm-message-state;\r
28         bh=kuMR8i8//GjDPnayKBA26wSaRjW5qhDC403hC5k16W4=;\r
29         b=hz0H4DoIkKQ+tzBF2TplCX8d3p8sQXfLbSQSyry2w/v38Bl5zMIa7PDX8PJpPo2IxN\r
30         bHT3aouqhfSSMcoK+fRLk0XjucXB2Y5Vvf6sb1OPCuc7NkT788p52xgEv3MpDwpfLBnh\r
31         8LhYuf++nL+4nMVhy/JzMu97vn4jUmigCS3gdDJAdYgJ3hZzrm3Xrd5jKjZxHkHdH+y9\r
32         Rqs0/2Aw3FaiFls0wbZvil5FdrWgzs4pJTXac+u67qYX2hg1AXtWr9emUnspEyslDTMG\r
33         Abm4oVatJ8+rUOPhCjDgE8SxVbco6SMApL1pSVdE6y6Ik3URj0CbQP/OR/YKc6gQKpho\r
34         Jsjw==\r
35 X-Received: by 10.204.9.132 with SMTP id l4mr757529bkl.6.1358788920678;\r
36         Mon, 21 Jan 2013 09:22:00 -0800 (PST)\r
37 Received: from localhost ([2001:4b98:dc0:43:216:3eff:fe1b:25f3])\r
38         by mx.google.com with ESMTPS id z5sm9100364bkv.11.2013.01.21.09.21.58\r
39         (version=TLSv1.1 cipher=RC4-SHA bits=128/128);\r
40         Mon, 21 Jan 2013 09:21:59 -0800 (PST)\r
41 From: Jani Nikula <jani@nikula.org>\r
42 To: Tomi Ollila <tomi.ollila@iki.fi>,\r
43  Mark Walters <markwalters1009@gmail.com>,      notmuch@notmuchmail.org\r
44 Subject: Re: [PATCH 0/5] notmuch batch count\r
45 In-Reply-To: <m27gndsotu.fsf@guru.guru-group.fi>\r
46 References: <cover.1358273133.git.jani@nikula.org> <8738y2ui4y.fsf@qmul.ac.uk>\r
47         <m27gndsotu.fsf@guru.guru-group.fi>\r
48 User-Agent: Notmuch/0.14+259~gdee88db (http://notmuchmail.org) Emacs/23.2.1\r
49         (x86_64-pc-linux-gnu)\r
50 Date: Mon, 21 Jan 2013 18:21:52 +0100\r
51 Message-ID: <87fw1u30zz.fsf@nikula.org>\r
52 MIME-Version: 1.0\r
53 Content-Type: text/plain; charset=us-ascii\r
54 X-Gm-Message-State:\r
55  ALoCoQlCOo36TwIctYUCCJ9uT0DvYeW9V87wFqoTC4ATD4tJ1DPx+llxWGFZfe/v3WXxRpbdsNLN\r
56 X-BeenThere: notmuch@notmuchmail.org\r
57 X-Mailman-Version: 2.1.13\r
58 Precedence: list\r
59 List-Id: "Use and development of the notmuch mail system."\r
60         <notmuch.notmuchmail.org>\r
61 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
62         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
63 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
64 List-Post: <mailto:notmuch@notmuchmail.org>\r
65 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
66 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
67         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
68 X-List-Received-Date: Mon, 21 Jan 2013 17:22:04 -0000\r
69 \r
70 On Wed, 16 Jan 2013, Tomi Ollila <tomi.ollila@iki.fi> wrote:\r
71 > On Wed, Jan 16 2013, Mark Walters <markwalters1009@gmail.com> wrote:\r
72 >\r
73 >> On Tue, 15 Jan 2013, Jani Nikula <jani@nikula.org> wrote:\r
74 >>> Hi all -\r
75 >>>\r
76 >>> Notmuch remote usage [1] is a pretty handy way of accessing a notmuch\r
77 >>> database on a remote server. However, the more you have saved searches\r
78 >>> and tags, the slower notmuch-hello becomes, and it ends up being by and\r
79 >>> far the biggest usability issue with remote notmuch. This is because\r
80 >>> notmuch-hello issues a separate 'notmuch count' for each saved search\r
81 >>> and tag.\r
82 >>>\r
83 >>> One could argue that notmuch-hello should be fixed somehow, but I chose\r
84 >>> to try another route: batch support for notmuch count. This enables\r
85 >>> notmuch-hello to get the counts for all the saved searches or tags in a\r
86 >>> single call. The performance improvement is huge in remote usage, but\r
87 >>> it's not limited to that. Regular local usage benefits from it too, but\r
88 >>> it's not as obviously noticeable.\r
89 >>\r
90 >> This series looks good to me (that is the code looks fine).\r
91 >>\r
92 >> Two questions are:\r
93 >>\r
94 >> Do we want this functionality? I think it is useful even on local setups\r
95 >> particularly if people have lots of tags (the section that shows all\r
96 >> tags can be quite noticeably sped up). It is a substantial improvement\r
97 >> on remote setups but I am not sure if that is sufficiently common to\r
98 >> warrant the change. At least the code path is the same so it will get\r
99 >> enough testing.\r
100 >\r
101 > I do want the functionality. Especialy where I am now it takes about\r
102 > 0.4 sec for 'ssh remote echo foo' to get executed (using connection sharing).\r
103 > pipelining the count requests could make all the count requests emacs\r
104 > does (in my current set) to complete in less than 1 sec. \r
105 >\r
106 >> Secondly, if we do the functionality should it be more general so that\r
107 >> it can do searches etc too. I think this is less clear. Count is likely\r
108 >> to be the most useful one since running several (simultaneous) counts is\r
109 >> probably more common than running several simultaneous searches.\r
110 >\r
111 > One could argue that we'd should send json "documents" to notmuch in\r
112 > stdin and notmuch would output json(/sexp) "documents". That is just\r
113 > SMOP. I bet Austin would like this solution, especially the part\r
114 > that involves writing or integrating json parser >;). \r
115 > I'd be happy with this 'batch' approach. \r
116 >\r
117 > I'll be testing this soon, but refrain from reviewing the code\r
118 > until 0.15 is out.\r
119 \r
120 id:87a9s5cp38.fsf@zancas.localnet ;)\r
121 \r
122 J.\r
123 \r
124 \r
125 >\r
126 >>\r
127 >> Best wishes\r
128 >>\r
129 >> Mark\r
130 >\r
131 >\r
132 > Tomi\r
133 >\r
134 >\r
135 >>\r
136 >>\r
137 >>>\r
138 >>> Here's a script that demonstrates one-by-one count vs. batch count,\r
139 >>> locally and over ssh (assuming ssh key authentication is set up), over\r
140 >>> 10 iterations:\r
141 >>>\r
142 >>> #!/bin/bash\r
143 >>>\r
144 >>> echo "tag count:"\r
145 >>> notmuch search --output=tags "*" | wc -l\r
146 >>>\r
147 >>> for remote in "" "ssh example.com"; do\r
148 >>>     export remote\r
149 >>>     echo "one-by-one count:"\r
150 >>>     time sh -c 'for i in `seq 10`; do notmuch search --format=text0 --output=tags "*" | xargs -0 -n 1 -I "{}" $remote notmuch count tag:"{}" > /dev/null; done'\r
151 >>>\r
152 >>>     echo "batch count:"\r
153 >>>     time sh -c 'for i in `seq 10`; do notmuch search --format=text --output=tags "*" | sed "s/.*/tag:\"\0\"/" | $remote notmuch count --batch > /dev/null; done'\r
154 >>> done\r
155 >>>\r
156 >>> And here's the output of it in my setup:\r
157 >>>\r
158 >>> tag count:\r
159 >>> 36\r
160 >>> one-by-one count:\r
161 >>>\r
162 >>> real        0m2.349s\r
163 >>> user        0m0.552s\r
164 >>> sys 0m0.868s\r
165 >>> batch count:\r
166 >>>\r
167 >>> real        0m0.179s\r
168 >>> user        0m0.120s\r
169 >>> sys 0m0.064s\r
170 >>> one-by-one count:\r
171 >>>\r
172 >>> real        0m56.527s\r
173 >>> user        0m1.424s\r
174 >>> sys 0m1.164s\r
175 >>> batch count:\r
176 >>>\r
177 >>> real        0m2.407s\r
178 >>> user        0m0.068s\r
179 >>> sys 0m0.040s\r
180 >>>\r
181 >>> As can be seen, in local usage (the first pair of results) the speedup\r
182 >>> is more than 10x, although one-by-one notmuch count is usually\r
183 >>> sufficiently fast. The difference is more noticeable in remote use (the\r
184 >>> second pair of results), where the speedup is 20x here, and any\r
185 >>> additional, occasional network latency is multiplied by tag count. (That\r
186 >>> result is actually faster than usual for me, but it's still 5+ seconds\r
187 >>> to display or refresh notmuch-hello.)\r
188 >>>\r
189 >>> Mark has written a patch that I've been using to switch notmuch-hello to\r
190 >>> use batch count. That has made me switch from running notmuch in ssh to\r
191 >>> using remote notmuch. The great thing is that we could switch to using\r
192 >>> that in Emacs with no special casing for remote usage, and it would\r
193 >>> speed things up also in local use. I'm expecting Mark to post his patch\r
194 >>> in reply to this series.\r
195 >>>\r
196 >>> Mark actually wrote the elisp part based on the rough idea prior to any\r
197 >>> of this cli plumbing, so I felt obliged to follow up. So thanks Mark!\r
198 >>>\r
199 >>>\r
200 >>> BR,\r
201 >>> Jani.\r
202 >>>\r
203 >>>\r
204 >>> [1] http://notmuchmail.org/remoteusage/ (the page could use some\r
205 >>> cleanup; it's really not nearly as complicated as the page suggests)\r
206 >>>\r
207 >>>\r
208 >>> Jani Nikula (5):\r
209 >>>   cli: remove useless strdup\r
210 >>>   cli: extract count printing to a separate function in notmuch count\r
211 >>>   cli: add --batch option to notmuch count\r
212 >>>   man: document notmuch count --batch and --input options\r
213 >>>   test: notmuch count --batch and --input options\r
214 >>>\r
215 >>>  man/man1/notmuch-count.1 |   20 +++++++++\r
216 >>>  notmuch-count.c          |  111 +++++++++++++++++++++++++++++++++++-----------\r
217 >>>  test/count               |   46 +++++++++++++++++++\r
218 >>>  3 files changed, 150 insertions(+), 27 deletions(-)\r
219 >>>\r
220 >>> -- \r
221 >>> 1.7.10.4\r
222 >> _______________________________________________\r
223 >> notmuch mailing list\r
224 >> notmuch@notmuchmail.org\r
225 >> http://notmuchmail.org/mailman/listinfo/notmuch\r