openstenoproject/plover

Suggestions window causes Plover to lag with large scrollback

Closed this issue · 3 comments

Describe the bug

Keeping the Plover: Suggestions window open causes Plover to eventually noticeably lag when there's a lot of scroll-back.

This may be related to issue #778 although it seems like a separate issue.

This slows down the performance of Plover with other windows, such as the Paper Tape window having delayed updates, along with words appearing like they are being typed slowly.

To Reproduce

Steps to reproduce the behavior:

  1. If the Plover: Suggestions window is not visible, navigate to the Plover tray/menu bar icon and select Tools > Suggestions.
  2. Keep the Plover: Suggestions open for your entire of session of Plover running.
  3. Wait until the Plover: Suggestions window's vertical scrollbar is approximately 12 logical pixels tall, depending on its window size—keep using Plover with steno inputs until it has a fairly large scroll-back. Usually lag is noticeable as the Suggestions window content builds up after a while.

image

Expected behavior

Plover's performance should remain like it is when the Suggestions window is not very populated without any degraded performance.

Manually clearing the Suggestions window with the 'bin' icon restores Plover's performance, with windows such as the Paper Tape and text appearing instantly as it should.

Screenshots

Not applicable.

Operating system

  • OS: Windows 11 21H2, Build 22000. 376
  • Plover Version: 4.0.0.dev10+120.g4394ef1

Hardware

Not applicable.

Not sure if there's anything Plover can do about this. The computer have to do the work and the work takes that much time, the way to avoid taking the time is to make it do less work.

Possible things to look for...

  • is the update code inefficient? (subject to Qt's API limitation)
  • is the GUI thread blocking the main thread? (it shouldn't.)

and

  • should there be some option to automatically clear the older entries when it reaches X entries?
dnaq commented

I think there's definitely something accidentally quadratic going on here. The amount of work plover has to do shouldn't have anything to do with the number of suggestions in the window.

The easy short term solution would be to cap the size of the scroll back buffer, but the real solution would be to find the cause of that quadratic behaviour.

Every time a new suggestion is added, the QListView ask for each previous suggestion' size... #1481 should speed up things nicely, please test.