-
Notifications
You must be signed in to change notification settings - Fork 326
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
Slow to edit large markdown file #323
Comments
I can confirm |
Something like that would help to just render the viewed content: https://twitter.com/ChromiumDev/status/1062433100804702208 |
me too, after disable this extension it is faster... |
I'm also experiencing this issue. |
Will investigate it when I come back from the holiday |
I think there are mainly two problems:
@neilsustc If I'm not mistaken, I will do some research about these two problems and try to fix them~ |
For problem 2, I have tested many times, here is the conclusion:
So there must be something wrong on I have also tried using Edits from command markdown.extension.onEnterKey were not applied.
extensionHostProcess.js:715
Edits from command markdown.extension.onEnterKey were not applied.
extensionHostProcess.js:715
Edits from command markdown.extension.onEnterKey were not applied.
extensionHostProcess.js:715
Edits from command markdown.extension.onEnterKey were not applied.
extensionHostProcess.js:715
Edits from command markdown.extension.onEnterKey were not applied. I'm trying to find another vs code extension which handles this problem gracefully. This issue is just what we are facing: microsoft/vscode#65876 |
Probably this is a problem with vs code's extension API, I'm not quite sure now. Update: It's an issue of our self, see comment below. |
Okay, I found the problem is not on the side of vs code itself. After some profile following the performance guide, I find the most cost function is If I comment this line: https://github.com/neilsustc/vscode-markdown/blob/08da4d53aac689531f3fc3dc3224fb3f5aeb2e2d/src/extension.ts#L34 Some analysis of the It takes O(n^2) time, which is too slow, so we should use dynamic programming to make it faster. Need further investigating! |
Edit: This comment is outdated. (You found it!) 😅 Thanks anyway. I tried to disable some of the features (e.g. TOC) to find out a smallest extension that still has this issue. That was the microsoft/vscode#50254. Now I am curious about whether this issue is still there if we comment out all other features except for If so, I think we can continue on this train of thought to find the smallest extension sample. (The one in microsoft/vscode#50254 is small but is not issue-reproducible...) |
Or a better heuristics for TOC detection. |
Another question, you generated a new TOC in Can we just simplify the TOC detection by adding something like this: <!-- begin table of content(Markdown All in One) -->
...
<!-- end table of content(Markdown All in One) -->
However, this may not work on the old files without these comments. We should tell our user to delete the old TOC and regenerate it. What do you think? |
The calculation of Levenshtein_distance cannot be faster than O(n^2 - ε) for any ε greater than zero. We must use another approach for TOC detection. |
…ance issues, support multiple tocs
I've encountered this issue too. Too slow work with large markdown files (5000 lines and more). I have to disable this extension to work normally. It's very inconvenient, because I use this extension intensively. Is it possible to disable some features in settings that slow down editing? I don't use toc, I've disabled |
Could you profile this extension as described here? Then we will know the reason. |
I don't know if I made everything correctly, but here it is. |
Tracked in a separate issue. For the people who have also experienced the performance issue, feel free to open a new one (with the CPU profile). |
What is the problem?
Slow to edit large markdown file when the plugin is active. If optimisation is difficult, probably offer an option to toggle on/off it for large file. As the plugin is really useful to generate the table of content.
How can I reproduce it?
You can use this file to test
https://gist.github.com/kenng/b04e246ee269ebd2e38b102047d1b1ec
Is there any error message in the console?
No error.
The text was updated successfully, but these errors were encountered: