From e3b9431e611fc7140c3b09c1da083be39c024d1e Mon Sep 17 00:00:00 2001 From: John Steele Scott Date: Sat, 20 Apr 2013 12:29:51 +0930 Subject: [PATCH] slow rendering of some HTML mail threads in emacs/notmuch due to shr. --- 47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 | 93 +++++++++++++++++++++++ 1 file changed, 93 insertions(+) create mode 100644 47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 diff --git a/47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 b/47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 new file mode 100644 index 000000000..651f48ec2 --- /dev/null +++ b/47/1e38e2870cefa2a02ed9156d43d6d81b0d5344 @@ -0,0 +1,93 @@ +Return-Path: +X-Original-To: notmuch@notmuchmail.org +Delivered-To: notmuch@notmuchmail.org +Received: from localhost (localhost [127.0.0.1]) + by olra.theworths.org (Postfix) with ESMTP id 7C586431FBC + for ; Fri, 19 Apr 2013 20:05:09 -0700 (PDT) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: 0 +X-Spam-Level: +X-Spam-Status: No, score=0 tagged_above=-999 required=5 + tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled +Received: from olra.theworths.org ([127.0.0.1]) + by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) + with ESMTP id hNnx8C3QljnQ for ; + Fri, 19 Apr 2013 20:05:09 -0700 (PDT) +Received: from plane.gmane.org (plane.gmane.org [80.91.229.3]) + (using TLSv1 with cipher AES256-SHA (256/256 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id D50F0431FB6 + for ; Fri, 19 Apr 2013 20:05:08 -0700 (PDT) +Received: from list by plane.gmane.org with local (Exim 4.69) + (envelope-from ) id 1UTO6p-0007tq-ID + for notmuch@notmuchmail.org; Sat, 20 Apr 2013 05:05:03 +0200 +Received: from ppp14-2-13-192.lns21.adl2.internode.on.net ([14.2.13.192]) + by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) + id 1AlnuQ-0007hv-00 + for ; Sat, 20 Apr 2013 05:05:03 +0200 +Received: from toojays by ppp14-2-13-192.lns21.adl2.internode.on.net with + local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 + for ; Sat, 20 Apr 2013 05:05:03 +0200 +X-Injected-Via-Gmane: http://gmane.org/ +To: notmuch@notmuchmail.org +From: John Steele Scott +Subject: slow rendering of some HTML mail threads in emacs/notmuch due to shr. +Date: Sat, 20 Apr 2013 12:29:51 +0930 +Lines: 33 +Message-ID: +Mime-Version: 1.0 +Content-Type: text/plain; charset=windows-1252 +Content-Transfer-Encoding: 8bit +X-Complaints-To: usenet@ger.gmane.org +X-Gmane-NNTP-Posting-Host: ppp14-2-13-192.lns21.adl2.internode.on.net +User-Agent: Mozilla/5.0 (X11; Linux x86_64; + rv:17.0) Gecko/20130329 Thunderbird/17.0.5 +X-BeenThere: notmuch@notmuchmail.org +X-Mailman-Version: 2.1.13 +Precedence: list +List-Id: "Use and development of the notmuch mail system." + +List-Unsubscribe: , + +List-Archive: +List-Post: +List-Help: +List-Subscribe: , + +X-List-Received-Date: Sat, 20 Apr 2013 03:05:09 -0000 + +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. + +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: + +shr-descend 11783 196.09731454 0.0166423928 +shr-generic 11681 190.86248305 0.0163395670 +shr-tag-blockquote 81 57.140909005 0.7054433210 +shr-tag-div 348 48.511533571 0.1394009585 +shr-insert-document 14 27.808360994 1.9863114995 +shr-tag-body 14 27.158463401 1.9398902429 +shr-tag-p 4121 23.766379281 0.0057671388 +shr-insert 8962 21.705253155 0.0024219206 +shr-colorize-region 1075 2.6348254729 0.0024510004 +shr-put-color 2135 2.4779991750 0.0011606553 +shr-indent 13246 1.5816357290 0.0001194047 +shr-expand-newlines 1075 1.4488115139 0.0013477316 +shr-find-fill-point 5281 0.9872837309 0.0001869501 +shr-tag-br 4162 0.9527550159 0.0002289175 +shr-transform-dom 11123 0.6487086020 5.832...e-05 +shr-remove-trailing-whitespace 14 0.5503726889 0.0393123349 +shr-ensure-paragraph 8412 0.5039738979 5.991...e-05 +shr-buffer-width 1075 0.4900505680 0.0004558609 +shr-tag-b 381 0.17374644 0.0004560274 +shr-fontize-cont 381 0.172155226 0.0004518509 +shr-tag-table 8 0.154814786 0.0193518482 + +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. ‘ shows up as \342\200\230). So I'll probably stick with gnus-w3m to get (barely) tolerable performance with decent rendering. + +Just putting this out there to maybe help the next person who gets annoyed by this slowness. + +Cheers, + +John + -- 2.26.2