Re: [PATCH 0/3] Fix gnus-inhibit-images bug in Emacs 24
[notmuch-archives.git] / fb / 37571c5ee0eeb37b62bfc9e3fa89583de99609
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 4809D429E26\r
6         for <notmuch@notmuchmail.org>; Tue, 15 Nov 2011 08:48:42 -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 6m9Gjjrqrkxc for <notmuch@notmuchmail.org>;\r
16         Tue, 15 Nov 2011 08:48:41 -0800 (PST)\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 7AF54429E21\r
21         for <notmuch@notmuchmail.org>; Tue, 15 Nov 2011 08:48:41 -0800 (PST)\r
22 Received: by wyg19 with SMTP id 19so3955395wyg.26\r
23         for <notmuch@notmuchmail.org>; Tue, 15 Nov 2011 08:48:40 -0800 (PST)\r
24 Received: by 10.180.105.102 with SMTP id gl6mr31210724wib.46.1321375720253;\r
25         Tue, 15 Nov 2011 08:48:40 -0800 (PST)\r
26 Received: from localhost ([109.131.148.49])\r
27         by mx.google.com with ESMTPS id n2sm14691483wiz.16.2011.11.15.08.48.39\r
28         (version=TLSv1/SSLv3 cipher=OTHER);\r
29         Tue, 15 Nov 2011 08:48:39 -0800 (PST)\r
30 From: Pieter Praet <pieter@praet.org>\r
31 To: Austin Clements <amdragon@MIT.EDU>\r
32 Subject: Re: [PATCH] emacs: Use a single buffer invisibility spec to fix\r
33         quadratic search cost.\r
34 In-Reply-To: <20111111052716.GU2658@mit.edu>\r
35 References: <1320807328-13728-1-git-send-email-amdragon@mit.edu>\r
36         <877h382jax.fsf@SSpaeth.de>\r
37         <CAPFwwQgsqe2NE9vm2RJHHK+8hWR_uMWKLHcxm0xkjduFboAfPw@mail.gmail.com>\r
38         <87d3czxsu9.fsf@praet.org> <20111111045341.GS2658@mit.edu>\r
39         <20111111052716.GU2658@mit.edu>\r
40 User-Agent: Notmuch/0.9+76~g2fd88e6 (http://notmuchmail.org) Emacs/23.3.1\r
41         (x86_64-unknown-linux-gnu)\r
42 Date: Tue, 15 Nov 2011 17:47:46 +0100\r
43 Message-ID: <87d3ctjpsd.fsf@praet.org>\r
44 MIME-Version: 1.0\r
45 Content-Type: text/plain; charset=us-ascii\r
46 Cc: notmuch@notmuchmail.org, servilio <servilio@gmail.com>\r
47 X-BeenThere: notmuch@notmuchmail.org\r
48 X-Mailman-Version: 2.1.13\r
49 Precedence: list\r
50 List-Id: "Use and development of the notmuch mail system."\r
51         <notmuch.notmuchmail.org>\r
52 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
53         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
54 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
55 List-Post: <mailto:notmuch@notmuchmail.org>\r
56 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
57 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
58         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
59 X-List-Received-Date: Tue, 15 Nov 2011 16:48:42 -0000\r
60 \r
61 On Fri, 11 Nov 2011 00:27:16 -0500, Austin Clements <amdragon@MIT.EDU> wrote:\r
62 > Quoth myself on Nov 10 at 11:53 pm:\r
63 > > Quoth Pieter Praet on Nov 11 at  4:04 am:\r
64 > > > I've tried getting some hard numbers using\r
65 > > > \r
66 > > >   #+begin_src sh\r
67 > > >     time emacs --eval '(progn\r
68 > > >         (notmuch)\r
69 > > >         (notmuch-search "*")\r
70 > > >         (while (get-buffer-process (current-buffer))\r
71 > > >             (sleep-for 0.1))\r
72 > > >         (kill-emacs))'\r
73 > > >   #+end_src\r
74 > > > \r
75 > > > ... but the results vary wildly on subsequent runs.\r
76 > > \r
77 > > For me, this doesn't actually display the results buffer (though I\r
78 > > don't know why not), which means it won't test this, since the problem\r
79 > > lies in the Emacs redisplay logic.\r
80\r
81 > This may or may not actually be correct, but the following seems more\r
82 > representative on my system:\r
83\r
84 >     time emacs --eval '(progn\r
85 >         (notmuch)\r
86 >         (notmuch-search "*")\r
87 >         (while (get-buffer-process (current-buffer))\r
88 >             (redisplay)\r
89 >             (sleep-for 0.1))\r
90 >         (kill-emacs))'\r
91\r
92 \r
93 Yup, that does the trick!\r
94 \r
95 These remained fairly consistent, even with both CPU cores enabled:\r
96 \r
97 |      |         SINGLE        |          DUAL         |\r
98 |      | before    | after     | before    | after     |\r
99 |------+-----------+-----------+-----------+-----------|\r
100 | real | 0m34.560s | 0m31.829s | 0m30.784s | 0m26.587s |\r
101 | user | 0m26.188s | 0m23.672s | 0m27.028s | 0m22.889s |\r
102 | sys  | 0m0.863s  | 0m0.907s  | 0m1.200s  | 0m1.243s  |\r
103 \r
104 \r
105 > This at least displays the buffer.  I also tried\r
106 > (accept-process-output) instead of the (sleep-for 0.1), which clearly\r
107 > behaved differently, but gave only slightly higher numbers.  If I\r
108 > timed just the search part, to exclude emacs start-up, I would have a\r
109 > better idea of which more closely matches my manual measurements.\r
110 \r
111 Oddly enough...  I ran some tests using `elp-instrument-package' and\r
112 your `time-it' macro [1] to keep emacs init out of the equation, and\r
113 both not only produced horribly fluctuating results (even with only a\r
114 single CPU core enabled), but often took *longer* as well!\r
115 \r
116 I'm stumped...\r
117 \r
118   #+begin_src emacs-lisp\r
119     (progn\r
120       (require 'notmuch)\r
121       (let ((elp-reset-after-results t))\r
122         (elp-instrument-package "notmuch")\r
123         (notmuch-search "*")\r
124         (while (get-buffer-process (current-buffer))\r
125           (redisplay)\r
126           (sleep-for 0.1))\r
127         (elp-results)))\r
128   #+end_src\r
129 \r
130   #+begin_src emacs-lisp\r
131     (defmacro time-it (code)\r
132       `(let ((start-time (get-internal-run-time)))\r
133          ,code\r
134          (float-time (time-subtract (get-internal-run-time) start-time))))\r
135 \r
136     (require 'notmuch)\r
137 \r
138     (time-it (progn\r
139                (notmuch-search "*")\r
140                (while (get-buffer-process (current-buffer))\r
141                  (redisplay)\r
142                  (sleep-for 0.1))))\r
143   #+end_src\r
144 \r
145 \r
146 Peace\r
147 \r
148 -- \r
149 Pieter\r
150 \r
151 [1] id:"20110713185721.GI25558@mit.edu"\r