retext icon indicating copy to clipboard operation
retext copied to clipboard

Editor slows down in large documents

Open holzkohlengrill opened this issue 7 years ago • 19 comments

I have a document with ~6400 lines of text. In this tab (but not in others) the delay between a keystroke and the displayed text gets notably high. This should be improved.

Python 3.6.1rc1 (v3.6.1rc1^0:e0fbe5feee4f9c00f09eb9659c2182183036261a, Mar  4 2017, 20:00:12) [MSC v.1900 64 bit (AMD64)
] on win32

holzkohlengrill avatar Apr 26 '18 12:04 holzkohlengrill

Do you have line numbers enabled? If yes, the linked commit (in master) may help. It would be nice if you could test it.

mitya57 avatar Jul 13 '18 21:07 mitya57

I have now pushed some more optimizations to the master version, now editing large documents should be even faster.

There is still a remaining problem with spell checker, but it affects only initial loading of the document, not editing it.

mitya57 avatar Jul 16 '18 10:07 mitya57

I tried the 7.0.3 Version. However I did not perceive any performance gain. Python 3.7.0b5 Line numbers are activated. After some testing it seems that mainly line numbering is slowing everything down.

holzkohlengrill avatar Jul 20 '18 12:07 holzkohlengrill

This is fixed in master branch, not in 7.0.3. It will be in the next release.

mitya57 avatar Jul 20 '18 15:07 mitya57

The master branch version works now smoothly with about 7800 lines and line numbering enabled.

holzkohlengrill avatar Jul 24 '18 08:07 holzkohlengrill

Performance decreased again: I am on commit db20aaadbd0663cf576a8e7e004fac2d954ffbe8

ReText.ini

editorFontSize=12
openLastFilesOnStartup=true
saveWindowGeometry=true
highlightCurrentLine=true
lineNumbersEnabled=true
spellCheck=true
documentStatsEnabled=true

$ python --version Python 3.7.0

holzkohlengrill avatar Oct 12 '18 13:10 holzkohlengrill

Can you try to bisect in which commit it happened?

mitya57 avatar Oct 12 '18 13:10 mitya57

By the way the newly introduced config link in the settings is not clickable (however right click + Copy Link Location works).

holzkohlengrill avatar Oct 12 '18 13:10 holzkohlengrill

O.K. it seems that the performance did not decreased by the later commits (even with d9f02191c39684c6256f5e95bd51170d79c29949 where you introduced the performance optimisations it is currently slow).

I only see two differences: the document size increased:

image

and I just moved from Windows 7 to 10. Haven tried it on Linux so far.

holzkohlengrill avatar Oct 12 '18 13:10 holzkohlengrill

Can you check if disabling line numbers and/or current line highlighting (maybe also spellchecker) makes it better?

It would be nice to know if it's a problem in the editor itself or in the addons to it.

mitya57 avatar Oct 12 '18 14:10 mitya57

I think I got the cause. It was the document stats which was slowing everything down. Seems that here is the bottleneck.

holzkohlengrill avatar Oct 12 '18 14:10 holzkohlengrill

Ok, I will look at optimizing it. Maybe you can attach your document if it's not private?

mitya57 avatar Oct 12 '18 14:10 mitya57

I am afraid. I cannot attach the document since it contains a lot of confidential data.

Almost everything (~98 %) of the documents are headlines or lists. So you might generate it yourself. Probably just the amount of text(amount: see above)/lines (currently 4594 lines) should be already enough to reproduce it.

holzkohlengrill avatar Oct 12 '18 14:10 holzkohlengrill

No problem, I will generate it.

mitya57 avatar Oct 12 '18 14:10 mitya57

I created two test documents. One is about 15.000 lines, the other about 4500 lines. The bigger one is almost unable to edit due to the performance decrease.

test-md-docs.zip

holzkohlengrill avatar Oct 12 '18 14:10 holzkohlengrill

By the way the newly introduced config link in the settings is not clickable

Can you please file a new bug for this, and attach a screenshot / paste what the link looks like for you? I have an idea what it may be, but I want to decouple it from this bug.

mitya57 avatar Oct 12 '18 16:10 mitya57

I was able to improve statistics count performance by about 1/3 in the linked commit. Can you please check if it makes it any better for you?

mitya57 avatar Oct 15 '18 15:10 mitya57

It seems better but there is still a certain noticeable lag.

holzkohlengrill avatar Oct 16 '18 09:10 holzkohlengrill

Maybe I will try to make statistics calculation asynchronous.

mitya57 avatar Oct 16 '18 10:10 mitya57