MarkdownLivePreview icon indicating copy to clipboard operation
MarkdownLivePreview copied to clipboard

Bug: Editing gets very slow and preview length is limited on larger files

Open marnovo opened this issue 8 years ago • 11 comments

I have a 70KB markdown file that around line 1700 (or 53KB of content) gets incredibly slow to edit and the MD preview pane stops to add any more lines after this, even tough it updates accordingly previous lines if I change them.

marnovo avatar Jan 31 '17 10:01 marnovo

I have a 70KB markdown file that around line 1700 (or 53KB of content) gets incredibly slow to edit

For now, I don't have a solution to improve the speed, unfortunately...

the MD preview pane stops to add any more lines after this, even tough it updates accordingly previous lines if I change them.

So, at the end of your file, if you add a line, nothing gets updated in the preview, BUT if you add somewhere else, it does?

math2001 avatar Feb 02 '17 06:02 math2001

For now, I don't have a solution to improve the speed, unfortunately...

Maybe add a config option to update rendering only every N ms?

So, at the end of your file, if you add a line, nothing gets updated in the preview, BUT if you add somewhere else, it does?

Yes and yes.

marnovo avatar Feb 02 '17 14:02 marnovo

I tried this and it crashed sublime text.

dessalines avatar Mar 04 '17 04:03 dessalines

For me in a markdown file with around 100 lines the key strokes are delayed to show in the original file and in the preview...

The plugin is very nice but with this lag it becomes a little uncomfortable to use :(

screenshot from 2017-03-04 15 15 17

I hope you can find a solution for this lag :)

Exadra37 avatar Mar 04 '17 15:03 Exadra37

Is it possible for the plugin to simply use a debounce method? As long as there has been input in the last 300ms ( or whatever configured value the user sets ), don't update but as soon as that timer expires, update the preview.

jhoff avatar Mar 19 '17 05:03 jhoff

Is it possible for the plugin to simply use a debounce method? As long as there has been input in the last 300ms ( or whatever configured value the user sets ), don't update but as soon as that timer expires, update the preview.

My thoughts as well. Might be a simple workaround, with little compromise.

marnovo avatar Mar 19 '17 22:03 marnovo

More important than the debounce, would be making sure that the markdown converter only runs for the line you're editing.

dessalines avatar Mar 19 '17 23:03 dessalines

@dessalines no because one line can affect other lines. Updating the preview each X s is a good idea, though. I just don't have time to work on it yet.

math2001 avatar Mar 20 '17 00:03 math2001

I think the only ones that are multi line are the code surrounders. It'd be easy to add a flag to always convert text in between those.

dessalines avatar Mar 20 '17 04:03 dessalines

With a proper debounce, it shouldn't matter if you redraw the whole document. I suspect that people aren't typing markdown so quickly that they need the preview to update faster than the blink of an eye. For me, I'm typing a sentence or two and then want to look over and see what it looks like. Even at a 200-300ms debounce, it would prevent the dragging input and most people wouldn't notice the delayed re-draw.

I don't know a lick of python otherwise I would take a stab at it. Thanks though for all the great work. This is easily one of my favorite plugins.

jhoff avatar Mar 20 '17 13:03 jhoff

This is easily one of my favorite plugins.

Wow... 😄

I've pushed a few commits that should help. Here are the changes:

  • the on_modified is now asynchronous. I tried this before, but the preview kept blinking. It doesn't anymore, so...
  • the preview can be refreshed only every x s with a setting (ctrl+shift+pPreferences: MarkdownLivePreview Settings)

Haven't tagged, because I'm scarred of this blinking thing

I want to make sure i'm just lucky to get my both computers (tested on a pretty slow one, though) to not get this blink, so I haven't tagged anything yet → users won't get the update.

So could you try to explicitely update this package? → ctrl+shift+pPackage Control: Upgrade Package, you might be able to find MarkdownLivePreview, I'm not sure.

If you don't, could you remove this package (your setting won't be removed, don't worry), try to add it as a repository, I think Package Control doesn't need tags to update repo that the user has manually added:

  1. ctrl+shift+pPackage Control: Add Repository
  2. Paste this in https://github.com/math2001/MarkdownLivePreview

Again: ctrl+shift+pPackage Control: Upgrade Package

If you still don't find it, install this package with git.

Please let me know which solution worked for you (for updating).

This message is addressed to anyone who's willing to help me with this issue 🙂

math2001 avatar Mar 22 '17 07:03 math2001