slow rendering of some HTML mail threads in emacs/notmuch due to shr.
authorJohn Steele Scott <toojays@toojays.net>
Sat, 20 Apr 2013 02:59:51 +0000 (12:29 +0930)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:54:25 +0000 (09:54 -0800)
47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 [new file with mode: 0644]

diff --git a/47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 b/47/1e38e2870cefa2a02ed9156d43d6d81b0d5344
new file mode 100644 (file)
index 0000000..651f48e
--- /dev/null
@@ -0,0 +1,93 @@
+Return-Path: <gmn-notmuch@m.gmane.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 7C586431FBC\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Apr 2013 20:05:09 -0700 (PDT)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id hNnx8C3QljnQ for <notmuch@notmuchmail.org>;\r
+       Fri, 19 Apr 2013 20:05:09 -0700 (PDT)\r
+Received: from plane.gmane.org (plane.gmane.org [80.91.229.3])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id D50F0431FB6\r
+       for <notmuch@notmuchmail.org>; Fri, 19 Apr 2013 20:05:08 -0700 (PDT)\r
+Received: from list by plane.gmane.org with local (Exim 4.69)\r
+       (envelope-from <gmn-notmuch@m.gmane.org>) id 1UTO6p-0007tq-ID\r
+       for notmuch@notmuchmail.org; Sat, 20 Apr 2013 05:05:03 +0200\r
+Received: from ppp14-2-13-192.lns21.adl2.internode.on.net ([14.2.13.192])\r
+       by main.gmane.org with esmtp (Gmexim 0.1 (Debian))\r
+       id 1AlnuQ-0007hv-00\r
+       for <notmuch@notmuchmail.org>; Sat, 20 Apr 2013 05:05:03 +0200\r
+Received: from toojays by ppp14-2-13-192.lns21.adl2.internode.on.net with\r
+       local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00\r
+       for <notmuch@notmuchmail.org>; Sat, 20 Apr 2013 05:05:03 +0200\r
+X-Injected-Via-Gmane: http://gmane.org/\r
+To: notmuch@notmuchmail.org\r
+From: John Steele Scott <toojays@toojays.net>\r
+Subject: slow rendering of some HTML mail threads in emacs/notmuch due to shr.\r
+Date: Sat, 20 Apr 2013 12:29:51 +0930\r
+Lines: 33\r
+Message-ID: <kkt0b4$d1a$1@ger.gmane.org>\r
+Mime-Version: 1.0\r
+Content-Type: text/plain; charset=windows-1252\r
+Content-Transfer-Encoding: 8bit\r
+X-Complaints-To: usenet@ger.gmane.org\r
+X-Gmane-NNTP-Posting-Host: ppp14-2-13-192.lns21.adl2.internode.on.net\r
+User-Agent: Mozilla/5.0 (X11; Linux x86_64;\r
+       rv:17.0) Gecko/20130329 Thunderbird/17.0.5\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Sat, 20 Apr 2013 03:05:09 -0000\r
+\r
+I've been enjoying using notmuch in emacs to handle my email, but some threads take aaaages to render. I'm talking three minutes for a thread with 15 messages. I'm not sure what it is in particular about this thread. Some combination of Outlook generated HTML and much repeated top-posting perhaps. I have observed similar slowness for threads of HTML mails produced by the ReviewBoard code review system.\r
+\r
+For this particular Outlook thread, I used elp-instrument package to instrument shr before showing the thread. The most time was spent in these functions:\r
+\r
+shr-descend                          11783       196.09731454  0.0166423928\r
+shr-generic                          11681       190.86248305  0.0163395670\r
+shr-tag-blockquote                   81          57.140909005  0.7054433210\r
+shr-tag-div                          348         48.511533571  0.1394009585\r
+shr-insert-document                  14          27.808360994  1.9863114995\r
+shr-tag-body                         14          27.158463401  1.9398902429\r
+shr-tag-p                            4121        23.766379281  0.0057671388\r
+shr-insert                           8962        21.705253155  0.0024219206\r
+shr-colorize-region                  1075        2.6348254729  0.0024510004\r
+shr-put-color                        2135        2.4779991750  0.0011606553\r
+shr-indent                           13246       1.5816357290  0.0001194047\r
+shr-expand-newlines                  1075        1.4488115139  0.0013477316\r
+shr-find-fill-point                  5281        0.9872837309  0.0001869501\r
+shr-tag-br                           4162        0.9527550159  0.0002289175\r
+shr-transform-dom                    11123       0.6487086020  5.832...e-05\r
+shr-remove-trailing-whitespace       14          0.5503726889  0.0393123349\r
+shr-ensure-paragraph                 8412        0.5039738979  5.991...e-05\r
+shr-buffer-width                     1075        0.4900505680  0.0004558609\r
+shr-tag-b                            381         0.17374644    0.0004560274\r
+shr-fontize-cont                     381         0.172155226   0.0004518509\r
+shr-tag-table                        8           0.154814786   0.0193518482\r
+\r
+If I change mm-text-html-renderer to gnus-w3m instead of shr, notmuch-show renders this thread in the region of 3-7s, which still feels quite slow, but is an immense improvement. Setting it to lynx gives rendering times in the 2-3s ballpark, but it doesn't do bold/italic formatting, and some characters such are being rendered as escape sequences (e.g. \91 shows up as \342\200\230). So I'll probably stick with gnus-w3m to get (barely) tolerable performance with decent rendering.\r
+\r
+Just putting this out there to maybe help the next person who gets annoyed by this slowness.\r
+\r
+Cheers,\r
+\r
+John\r
+\r