Re: [PATCH 1/2] Add Google Inc. to AUTHORS as a contributor.
[notmuch-archives.git] / 7f / bbbacae1ad70252595f9e2b8fc1cc666207c35
1 Return-Path: <tomi.ollila@iki.fi>\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 8EBEB431FAF\r
6         for <notmuch@notmuchmail.org>; Wed,  8 Feb 2012 01:59:38 -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\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
12         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 kEOkO54WAUez for <notmuch@notmuchmail.org>;\r
16         Wed,  8 Feb 2012 01:59:37 -0800 (PST)\r
17 Received: from guru.guru-group.fi (guru-group.fi [87.108.86.66])\r
18         by olra.theworths.org (Postfix) with ESMTP id B8D41431FAE\r
19         for <notmuch@notmuchmail.org>; Wed,  8 Feb 2012 01:59:36 -0800 (PST)\r
20 Received: by guru.guru-group.fi (Postfix, from userid 501)\r
21         id ADC3668055; Wed,  8 Feb 2012 11:59:36 +0200 (EET)\r
22 From: Tomi Ollila <tomi.ollila@iki.fi>\r
23 To: David Edmondson <dme@dme.org>, notmuch@notmuchmail.org\r
24 Subject: Re: [PATCH v3] emacs: Call "notmuch tag" once when applying tag\r
25         changes to a thread.\r
26 In-Reply-To: <1328690169-6991-1-git-send-email-dme@dme.org>\r
27 References: <1328632303-31877-1-git-send-email-jani@nikula.org>\r
28         <1328690169-6991-1-git-send-email-dme@dme.org>\r
29 User-Agent: Notmuch/0.11.1+164~g6619341 (http://notmuchmail.org) Emacs/23.3.1\r
30         (x86_64-unknown-linux-gnu)\r
31 X-Face: HhBM'cA~<r"^Xv\KRN0P{vn'Y"Kd;zg_y3S[4)KSN~s?O\"QPoL\r
32         $[Xv_BD:i/F$WiEWax}R(MPS`^UaptOGD`*/=@\1lKoVa9tnrg0TW?"r7aRtgk[F\r
33         !)g;OY^,BjTbr)Np:%c_o'jj,Z\r
34 Date: Wed, 08 Feb 2012 11:59:36 +0200\r
35 Message-ID: <m2liody7av.fsf@guru.guru-group.fi>\r
36 MIME-Version: 1.0\r
37 Content-Type: text/plain; charset=us-ascii\r
38 X-BeenThere: notmuch@notmuchmail.org\r
39 X-Mailman-Version: 2.1.13\r
40 Precedence: list\r
41 List-Id: "Use and development of the notmuch mail system."\r
42         <notmuch.notmuchmail.org>\r
43 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
44         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
45 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
46 List-Post: <mailto:notmuch@notmuchmail.org>\r
47 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
48 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
49         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
50 X-List-Received-Date: Wed, 08 Feb 2012 09:59:38 -0000\r
51 \r
52 On Wed,  8 Feb 2012 08:36:09 +0000, David Edmondson <dme@dme.org> wrote:\r
53 > Optimize thread tagging by combining all the tagging operations to a\r
54 > single "notmuch tag" call.\r
55\r
56 > For threads in the order of tens or a hundred inbox tagged messages,\r
57 > this gives a noticeable speedup. On two different machines, archiving\r
58 > a thread of about 50 inbox tagged messages goes down from 10+ seconds\r
59 > to about 0.5 seconds.\r
60\r
61 > The bottleneck is not within emacs; the same behaviour can be observed\r
62 > in the CLI. This approach has the added benefit of being more\r
63 > reliable: any of the individual tagging operations might face a locked\r
64 > database, leading to partial results.\r
65\r
66 > This introduces a limitation to the number of messages that can be\r
67 > archived at the same time (through ARG_MAX limiting the command\r
68 > line). While at least on Linux this seems more like a theoretical\r
69 > limitation than a real one, it could be avoided by archiving at most a\r
70 > few hundred messages at a time.\r
71 \r
72 I did a simple test program:\r
73 \r
74 --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--\r
75 #!/usr/bin/perl\r
76 \r
77 use strict;\r
78 use warnings;\r
79 \r
80 die "Usage: $0 <arglen> <# of args>\n" unless @ARGV == 2;\r
81 \r
82 my $arg = 'x' x $ARGV[0];\r
83 my @args = ( $arg ) x $ARGV[1];\r
84 \r
85 print "One arg: '$arg'\n";\r
86 print 'Number of args: ', scalar @args, "\n";\r
87 \r
88 exec '/bin/true', @args;\r
89 --8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<--\r
90 \r
91 This program executes /bin/true with given number of args all args\r
92 of some length: i.e.\r
93 \r
94 ./test_cmdlimit 100 10000 \r
95 \r
96 makes 10000 100 character arguments (total of million characters)\r
97 and executes /bin/true with those ten thousand 100-char args.\r
98 \r
99 In one machine where  getconf ARG_MAX  returns 131072\r
100 (Debian Lenny ia32)\r
101 \r
102 ./test_cmdlimit 200 10000   succeeds\r
103 but\r
104 ./test_cmdlimit 20 100000   gives\r
105 Can't exec "/bin/true": Argument list too long at ./test_cmdlimit.pl line 14.\r
106 \r
107 Hmm, actually there:\r
108 ./test_cmdlimit 19 100000   succeeds and\r
109 ./test_cmdlimit.pl 209 10000 fails\r
110 \r
111 More with args which lengths are 1 and 2 chars:\r
112 \r
113 ./test_cmdlimit.pl 1 1046163 succeeds\r
114 ./test_cmdlimit.pl 1 1046164 fails\r
115 \r
116 ./test_cmdlimit.pl 2 697442 succeeds\r
117 ./test_cmdlimit.pl 2 697443 fails\r
118 \r
119 1046163 was close to 1048576 (1024 * 1024) --\r
120 697442 * 2 is 1394884...\r
121 \r
122 >From these I can make an educated guess that when message id:s\r
123 are typically between 30 to 70 characters something like\r
124 20 000 messages are safe to be tagged at once in this\r
125 test system (./test_cmdlimit.pl 50 40000 succeeds).\r
126 \r
127\r
128 > Based on code from Jani Nikula <jani@nikula.org>.\r
129 \r
130 Tomi\r