Skip to content
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

Editor slows down in large documents #360

Open
holzkohlengrill opened this issue Apr 26, 2018 · 19 comments
Open

Editor slows down in large documents #360

holzkohlengrill opened this issue Apr 26, 2018 · 19 comments

Comments

@holzkohlengrill
Copy link

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
mitya57 added a commit that referenced this issue Jul 13, 2018
block.isVisible() is always True, check the rectangle to find out
if it is really in the viewport.

Break the loop if the block is below the viewport.

Move some common variables outside the loop.

Refs #360.
@mitya57
Copy link
Member

mitya57 commented Jul 13, 2018

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
Copy link
Member

mitya57 commented Jul 16, 2018

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 mitya57 closed this as completed Jul 16, 2018
@holzkohlengrill
Copy link
Author

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.

@mitya57
Copy link
Member

mitya57 commented Jul 20, 2018

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

@holzkohlengrill
Copy link
Author

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

@holzkohlengrill
Copy link
Author

Performance decreased again: I am on commit db20aaa

ReText.ini

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

$ python --version
Python 3.7.0

@mitya57
Copy link
Member

mitya57 commented Oct 12, 2018

Can you try to bisect in which commit it happened?

@holzkohlengrill
Copy link
Author

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

@holzkohlengrill
Copy link
Author

O.K. it seems that the performance did not decreased by the later commits (even with d9f0219 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.

@mitya57
Copy link
Member

mitya57 commented Oct 12, 2018

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 mitya57 reopened this Oct 12, 2018
@holzkohlengrill
Copy link
Author

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

@mitya57
Copy link
Member

mitya57 commented Oct 12, 2018

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

@holzkohlengrill
Copy link
Author

holzkohlengrill commented Oct 12, 2018

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.

@mitya57
Copy link
Member

mitya57 commented Oct 12, 2018

No problem, I will generate it.

@holzkohlengrill
Copy link
Author

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

@mitya57
Copy link
Member

mitya57 commented Oct 12, 2018

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
Copy link
Member

mitya57 commented Oct 15, 2018

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?

@holzkohlengrill
Copy link
Author

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

@mitya57
Copy link
Member

mitya57 commented Oct 16, 2018

Maybe I will try to make statistics calculation asynchronous.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants