slow rendering of some HTML mail threads in emacs/notmuch due to shr.

John Steele Scott toojays at toojays.net
Fri Apr 19 20:19:53 PDT 2013


On 20/04/13 12:29, John Steele Scott wrote:
> 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

I should have mentioned, I'm using:
GNU Emacs 24.3.1 built from bzr://bzr.savannah.gnu.org/emacs/emacs-24/ revno: 111336
notmuch 0.14+142~g2bd922f

> 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
> 




More information about the notmuch mailing list