pazz / alot

Terminal-based Mail User Agent
GNU General Public License v3.0
696 stars 164 forks source link

ANSIText makes startup slow #1530

Open mjg opened 4 years ago

mjg commented 4 years ago

Describe the bug Startup of alot is very slow (10s instead of <1s) since the last update. I bisected this to: 530addcb ("mimetree-rebase: FocusText -> ANSIText (See #1015)", 2020-02-17)

Software Versions

To Reproduce Steps to reproduce the behaviour:

  1. start alot

This indicates that message parts are loaded unnecessarily in thread mode, so I do hope that #1523 might help.

mjg commented 4 years ago

Update: yes, #1523 greatly helps. Though one could say that it covers up the slowness of the ANSItext widget ...

pazz commented 4 years ago

weird. the new widgets did not make anything slow for me. Perhaps it is due to this new patch to interpret plaintext parts via mailcap if defined, and your system is configured to call some slow big converter? Can you check your mailcaps?

mjg commented 4 years ago

Well, I literally bisected this (git bisect) to the commit that I mentioned (with plain pazz/alot, no own patches). So, unless the ANSIText widget uses mailcap and the old one does not this is not related.

In any case, my mailcap has text/html; elinks -force-html -dump -dump-color-mode 3 -dump-charset utf8 -eval 'set document.codepage.assume = "%{charset}"' %s; copiousoutput and nothing for plain text, nor does the system mailcap.

Maybe I have too many HTML mails in my inbox and elinks is slow?

pazz commented 4 years ago

Quoting Michael J Gruber (2020-06-22 19:57:41)

Well, I literally bisected this (git bisect) to the commit that I mentioned (with plain pazz/alot, no own patches). So, unless the ANSIText widget uses mailcap and the old one does not this is not related.

Thanks but this makes no sense to me. Yes this commit activates ANSIText (this should have been active before?!) But that widget is not much more complicated than normal text. I expect pythons re module to be fast here. Again, I cannot reproduce this but if someone else can I'd be interested to hear how.

I am not a master in python profiling but you may try to profile alot and see what's taking so long.

https://docs.python.org/3/library/profile.html

#!/usr/bin/python
import cProfile
from alot.__main__ import main
cProfile.run('main()', 'callstats')

In any case, my mailcap has text/html; elinks -force-html -dump -dump-color-mode 3 -dump-charset utf8 -eval 'set document.codepage.assume = "%{charset}"' %s; copiousoutput and nothing for plain text, nor does the system mailcap.

Thx for confirming. This was a long shot anyway.

Maybe I have too many HTML mails in my inbox and elinks is slow?

Well possible. Have you tried starting alot with a less well populated search query (alot search bla)?