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

Typing - letter rendering lagging #2129

Open
Lledor opened this issue Dec 1, 2024 · 10 comments
Open

Typing - letter rendering lagging #2129

Lledor opened this issue Dec 1, 2024 · 10 comments
Labels
investigate Meta: Requires further investigation qt issue Issue: Upstream issue in Qt usability Issue: Could do with some improvement

Comments

@Lledor
Copy link

Lledor commented Dec 1, 2024

Hi,

I’m currently using Version 2.6 Beta 1 on Windows 10 and have noticed occasional lags while typing. There’s a noticeable delay between typing and the text appearing on the screen. This issue is specific to this application, as other programs on my computer are functioning normally.

Thank you for your assistance.

@Lledor Lledor added the bug Issue: Something isn't working label Dec 1, 2024
@vkbo vkbo added usability Issue: Could do with some improvement investigate Meta: Requires further investigation and removed bug Issue: Something isn't working labels Dec 1, 2024
@vkbo
Copy link
Owner

vkbo commented Dec 1, 2024

There are three things running while you type: Auto-replace features, spell checking, and syntax highlighting. To check if any of these are the cause, you can turn off as much as possible of these in Preferences. If turning them off have no effect, then there is likely another cause, which may be trickier to find.

There are some changes to syntax highlighting in 2.6. Mainly the new dialogue highlighting for languages that use dashes as dialogue markers. These are only enabled when these Preferences are set. There is also a minor change to auto-replace where an additional dash was added, but overall, there isn't much change since 2.5.

@Lledor
Copy link
Author

Lledor commented Dec 1, 2024

Okay, I follow your recommendation - thank you for your help.

@vkbo
Copy link
Owner

vkbo commented Dec 3, 2024

Did changing any settings make a difference?

@Lledor
Copy link
Author

Lledor commented Dec 3, 2024

Yes, in my case the auto-replace, was the culprit. Apologies for not letting you know earlier.

@vkbo
Copy link
Owner

vkbo commented Dec 3, 2024

Sure, no problem. The auto-replacer keeps growing slowly. and there's quite a lot of code to run through on each keypress. I'll look into optimising it a little.

@vkbo vkbo added this to the Release 2.6 Beta 2 milestone Dec 3, 2024
@vkbo
Copy link
Owner

vkbo commented Dec 3, 2024

Hmm, with English settings, it takes about 30 microseconds to process on my laptop. That shouldn't be noticeable. What kind of auto-replace settings did you have? Any of the special French/Spanish ones that inserts spaces around punctuation?

@Lledor
Copy link
Author

Lledor commented Dec 3, 2024

UK English only, spell check on and nothing much else. Syntax highlighting on did not affect it, only the auto-replace. It may even be my small desktop computer? Windows 10 System Type: x64-based PC Processor:Intel(R) Celeron(R) J4125 CPU @ 2.00GHz, 2001 Mhz, 4 Core(s), 4 Logical Processor(s). I am in the process of moving my work over from Scrivener, but that is idle as I work in novelWriter.

@vkbo
Copy link
Owner

vkbo commented Dec 3, 2024

It could just be processing priority or something like that. novelWriter is designed to be light on resources, but Python is also fairly slow, so anything that requires real-time processing as you type can potentially be an issue. Since the problem is intermittent, I expect resources do play a role here.

I also get the impression the whole framework novelWriter runs on is a little slower on Windows than on Linux. So it may very well be that it's not a matter of how fast the auto-replace feature can run, but the fact that it has to run in the same thread as the text rendering. That's a Qt requirement, and unavoidable. So optimising the code might not help, as the problem may be that this part of the code has to run at all. If that makes sense.

Do these intermittent delays coincide with either auto-save (every 30 seconds by default) or word counting (every 5 seconds by default)?

Edit: Word counting does run in a separate thread, but it does a partial save process ahead of the count to extract the text to process, so there is still a small interruption. Most of these interruptions have been timed, and should in most cases be in the microseconds range, which is not on its own perceptible as a delay.

@Lledor
Copy link
Author

Lledor commented Dec 3, 2024

The settings are default, save document 30 seconds, word counting 5 seconds. I will moving over to Linux Mint in the near future, this is my reason for dumping Scrivener (apart from it being too bloated an application) so it is good to know that it work better on Linux. I think that move may be quicker that I anticipated?

@vkbo
Copy link
Owner

vkbo commented Dec 5, 2024

I tested this on a Windows virtual machine, so a fairly low resource environment, and I can reproduce your issue. However, I cannot make it go away by turning off auto-replace. I suspect this has nothing to do with the auto-replace itself, but a rendering delay. There were minimal resource usage, and the auto-replace took nowhere enough time to cause the delay. Perhaps turning it off in your case keeps it just below the threshold where it starts lagging.

A little web search revealed similar reports on Windows, even on minimal example code, so this may be Qt-related. It's hard to say. I would like to hold off on these kind of potential Qt-related issues until novelWriter moves to Qt6, which may or may not fix some of them. It will be a good jump forward in versions.

The plan is to make the switch in 2.7, ahead of the Qt5 end of life in May.

@vkbo vkbo mentioned this issue Dec 5, 2024
6 tasks
@vkbo vkbo added the qt issue Issue: Upstream issue in Qt label Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Meta: Requires further investigation qt issue Issue: Upstream issue in Qt usability Issue: Could do with some improvement
Projects
None yet
Development

No branches or pull requests

2 participants