-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Markdown mode is getting slow #101
Comments
I'm sorry for being so harsh. I'm trying to investigate cause of this disaster. Smartparens executes a lot of stuff even when disabled. I'll need to remove it completely together with Flyspell to adequately profile the rest of offending packages. |
Here we go:
When I hold a key, I can see how characters periodically slow down for GC. This is poor performance anyway — this should not happen and it does not happen in modes with more complicated syntax than markdown. Fontification is slow. When combined with other nasty things, it stops you from normal interaction with editor altogether. Can you imporve this? |
Edit: fontification is not slow, it's rather memory-inefficient if you spend 20% if time in GC. In Emacs lisp mode it's 5 % even with some plugins like aggressive indentation. |
First, can you confirm that you are using the latest master? Much effort recently has gone towards efficiency. I have done similar profiling and have seen significant improvement since December or so. See for example #30, #42, and #44. For me, the lag while typing now is almost imperceptible in a complicated 5000+ line file. Due to the complexity, parsing Markdown on the fly as a user edits is neither easy nor fast when compared to a very structured language, like most programming languages, which can use the Emacs syntax table for everything. Multi-line constructs, nesting lists and pre blocks, etc. mean that we have to sometime go back far in the document to determine the context. Recently, I have moved towards caching this context in text properties. That being said, I still care a lot about making markdown-mode as efficient as possible. If you have other suggestions for improvement they are most welcome, especially in the form of patches. Many people use Markdown when editing wikis, including on GitHub, which is why the wiki features exist. However, I agree that most people do not need this and therefore adding flags to disable checking for wiki links is something I've already planned to do. We need two flags: one to globally disable wiki link fontification, say |
Yes, I update all packages regularly (every day) from MELPA, so my version of |
Please see f8fd642. |
Thank you, I will try it. |
I'm running markdown-mode (20160722.445) with emacs 24.5.1. There is still good amount of lag even when just moving around with cursor keys or typing anything. Any ways to improve this? |
I see the lag was because I was editing a .md file over sshfs. There is no lag when I edit a local .md file. Sorry for false alarm. |
I'm on the most recent markdown-mode and still getting significant lag in some markdown-mode buffers when merely typing. Turning off font-lock-mode resolves the issue but this is a suboptimal solution. |
Could someone with permission please add the |
This is a closed issue, so no need for a tag. It will help if you open a new issue with a specific problem narrowed down. Try using the profiler, with a test document. |
Except that it greatly helps people looking for similar issues to their own, which is the entire point of an issue tracker. |
Thanks. Profiling clearly shows that markdown-mode (specifically Moving these multi-asterisk lines into code blocks fixed the massive lag, I assume because markdown-mode no longer tried to calculate nested boldings. Issue resolved for now. |
Thanks for following up with that. I am planning to add formatted yank commands (e.g., yank as code block) that will make this more efficient. |
I have the same issue for a file with a lot (~140) of GFM toggle boxes in a list. This is the report of the profiler:
|
@libre-man Thanks, the issue with GFM checkboxes should be fixed now (by commit c9955dc). |
I'm trying to fight frightening typing latency in my Emacs. It LAGS WHEN I TYPE. It's slower than an IDE. It's become really slow.
Please think twice when you put heavy code into hooks that are effectively executed after every key-press. I'm already thinking about writing state-less Smartparens that does not skyrocket latency. I already have to invent something to deal with the same issue with Flyspell. Heck, I have other things to do except for constantly making sure that I can type in Emacs normally. Every package puts a little bit of not-very-fast code into hooks, and then it all sums up. This is a real problem for me now. I don't even know why the heck I need to scan and fontify wiki links. What sort of Wiki? Can you make a variable that would turn off all these hooks expect for very-very basic ones? Or should I rewrite parts of
markdown-mode
in my config in order to be able to use it?The text was updated successfully, but these errors were encountered: