Skip to content

Browse mode: Elements List dialog: Delay applying filter for smoother response#10308

Merged
seanbudd merged 7 commits into
nvaccess:masterfrom
accessolutions:browseModeElementsListFilterDelay
Jun 20, 2023
Merged

Browse mode: Elements List dialog: Delay applying filter for smoother response#10308
seanbudd merged 7 commits into
nvaccess:masterfrom
accessolutions:browseModeElementsListFilterDelay

Conversation

@JulienCochuyt

Copy link
Copy Markdown
Contributor

Link to issue number:

Related to #7197, but does not solve it.

Summary of the issue:

In browse mode, in the Elements List dialog, speed typing a filter string leads to slow responsiveness from the UI and NVDA itself.

Description of how this pull request fixes the issue:

lightly delay the refresh of the elements list by 300 ms. (same technique as PR #10307)

Testing performed:

Known issues with pull request:

Change log entry:

I'm not sure this deserves to be announced.
Otherwise:

Section: Bug fixes
In browse mode, in the Elements List dialog, speed typing a filter string now longer makes NVDA lag.

Comment thread source/browseMode.py Outdated
Co-Authored-By: Leonard de Ruijter <leonardder@users.noreply.github.com>
@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

@feerrenrut here also, even more than for #10307, the retrieval of the filtered items is much slower than their drawing.
Would you prefer I try also for this one to reduce the delay to 200ms?

@feerrenrut

Copy link
Copy Markdown
Contributor

Would you prefer I try also for this one to reduce the delay to 200ms?

I think we should see how successful using the virtual tree control is. I expect we will need a mixture of these approaches. Tuning this delay time is going to be difficult, it will likely have a different optimal value on different computers. A third approach might be to do the list filtering in another (cancelable) thread. Restarting the work each time the filter gets updated.

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

@feerrenrut,
I have implemented the VirtualTree approach.
You can have a first look in accessolutions/nvda/inputGesturesVirtualTree / accessolutions/nvda@15478f898

After a lot of tweaks, it is slightly more efficient, but still not fully satisfying even on my race-horse development workstation.
It appears the most costly task is still to expand the categories as soon as there is a matching command.
I've tried to reduce the delay, but even 250 ms makes NVDA lag again when speed typing a filter text.
The current state of the branch shows an attempt to replace the delay timer by a separate thread: The result is even worse!

Thus, I would suggest either:

  • To consider the 300 ms delay as a necessary small pain regarding to its benefit
  • Not to expand the categories when there is a lot of matches, maybe by showing the number of matches next to the field. This would require an additional impact in the NVDA appModule to be vocalized, though.

@feerrenrut

Copy link
Copy Markdown
Contributor

I have implemented the VirtualTree approach.

Thanks for trying that out!

The current state of the branch shows an attempt to replace the delay timer by a separate thread: The result is even worse!

A surprising result, do you cancel this thread when typing resumes?

To consider the 300 ms delay as a necessary small pain regarding to its benefit

Yes, if none of these other options seem promising, we can certainly accept this approach.

@feerrenrut

Copy link
Copy Markdown
Contributor

do you cancel this thread when typing resumes?

Just looked at the branch, it seems you do. Though I'm concerned about accessing the gui from this other thread. I have commented on the commit.

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

do you cancel this thread when typing resumes?

Just looked at the branch, it seems you do. Though I'm concerned about accessing the gui from this other thread. I have commented on the commit.

It depends on which operations and which controls.
For this scope, wxPython/wxWidgets seems to handle just find delegating the necessary portions to its main loop, but consumes far too much time doing so.

Remember that the only real problem here (especially with VirtualTree) is expanding the categories.
All the rest happens quickly enough.

For a regular wxPython application, I'd just expand the categories one by one in the wx main thread, call wx.Yield every time and check for cancel conditions.
Within NVDA, its much harder to apply this classic technique since 2018.3 as wxPython 4 does not permit re-entrance of wx.Yield, which is called during the core pump cycle.

Would you prefer to keep the current PR as is, or that I cancel this one and file instead the Virtual Tree + delay timer? (Given that the separate thread version seems really not a viable option here.)

@feerrenrut

Copy link
Copy Markdown
Contributor

Remember that the only real problem here (especially with VirtualTree) is expanding the categories.
All the rest happens quickly enough.

If that's the case, perhaps do the filtering of categories that contain items that match to give an indication that filtering is working and only expand the categories after 300ms of no typing?

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

If that's the case, perhaps do the filtering of categories that contain items that match to give an indication that filtering is working and only expand the categories after 300ms of no typing?

Sounds worth trying. I'll test this approach on the VirtualTree branch and let you know.
Thanks

@feerrenrut

Copy link
Copy Markdown
Contributor

I'll test this approach on the VirtualTree branch and let you know.

It seems our conversations got a little mixed up between this PR and #10307

@JulienCochuyt can you confirm this PR is ready? I thought this would also be converted to a virtual tree?

@JulienCochuyt

Copy link
Copy Markdown
Contributor Author

@feerrenrut wrote:

It seems our conversations got a little mixed up between this PR and #10307

Indeed.

@JulienCochuyt can you confirm this PR is ready? I thought this would also be converted to a virtual tree?

It already improves the situation as is.
Unlike for PR #10307 - where expanding the categories was the big deal - it really is the retrieval of results which is costly here.
I'll probably try a few alternative approaches in the future, such as caching the unfiltered results upon first access - maybe in a VirtualTree if it helps. I'm not sure when I'll get time to, though.

@feerrenrut

Copy link
Copy Markdown
Contributor

I'm not entirely confident with this change. I might increasing this timeout doesn't have the effect that I would expect. I think I will need to look into it more.

@feerrenrut feerrenrut added the conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. label Mar 18, 2022
@JulienCochuyt JulienCochuyt requested a review from a team as a code owner June 23, 2022 09:34
@JulienCochuyt JulienCochuyt requested a review from seanbudd June 23, 2022 09:34
@seanbudd seanbudd added the stale PR is stale/old - NV Access has missed reviewing this or this is an abandoned draft label Apr 28, 2023
@CyrilleB79

Copy link
Copy Markdown
Contributor

@seanbudd, I can see that you have just added the new stale label.

  1. Regarding the "stale" label: what does it mean exactly? There is no associated description; could you add one?

  2. Regarding this PR: why is it stale?
    @JulienCochuyt requested a review 10 month ago, you added the blocked/needs-code-review label on Jul 5, 2022 and the CI does not show any merge conflict with master. Thus this PR should be reviewed or it should be indicated why this review cannot take place.

Thanks.

@seanbudd

seanbudd commented May 1, 2023

Copy link
Copy Markdown
Member

@CyrilleB79 - I have added the following description: "PR is stale/old - NV Access has missed reviewing this or this is an abandoned draft".
I have applied the label to 3 PRs which are stale, ready, and waiting on review.

Stale does not indicate merge conflicts or that it is blocked, we have separate labels for those 2 conditions.
Stale just indicates age.

@seanbudd seanbudd removed blocked/needs-code-review stale PR is stale/old - NV Access has missed reviewing this or this is an abandoned draft labels Jun 20, 2023

@seanbudd seanbudd left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this behaviour and it seems like an improvement to me.
When changing the filter text the filtered list is more responsive, as the timer is reset each time the text is changed.

I think Reef may have been concerned about the fact that when loading the filter, the list is visually built in front of the user, instead of becoming visible once all entries are loaded.

@seanbudd seanbudd merged commit a574f83 into nvaccess:master Jun 20, 2023
@nvaccessAuto nvaccessAuto added this to the 2023.2 milestone Jun 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component/NVDA-GUI conceptApproved Similar 'triaged' for issues, PR accepted in theory, implementation needs review. enhancement ux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants