Skip to content

Gecko_ia2 virtualBuffer's isAlive property: provide a roughly 14x speed-up, greatly reducing the lag seen when 10s of tabs are open in Firefox or chrome #7443

Merged
michaelDCurran merged 1 commit into
masterfrom
i3138
Aug 29, 2017

Conversation

@michaelDCurran

@michaelDCurran michaelDCurran commented Jul 26, 2017

Copy link
Copy Markdown
Member

Link to issue number:

Fixes #3138

Summary of the issue:

On every focus change, NVDA runs treeInterceptorHandler.cleanup() in order to kill off any dead virtualBuffers left from no longer existing documents. Gecko_ia2 virtualBuffer's isAlive property called AccessibleObjectFromEvent as one of the ways to validate if the document still existed. However, calling this many times can be very slow, and could produce a major lag on a system with 10s of tabs open in Firefox or Chrome. This call is no longer necessary these days as we can detect this by checking if the root object has the defunct state, or its properties no longer work.

Description of how this pull request fixes the issue:

The call to AccessibleObjectFromEvent has been removed. Also, rather than using the states property on the NVDAObject to check for defaunct, use the raw IAccessible2::States property instead. This is more direct and much faster, plus we can also catch any possible COMError and treat this the same as if defunct was there.
Note that Chrome currently produces a COMError when calling IAccessible2::states when dealing with an object for a document that has closed, rather than still supporting IA2_STATE_DEFUNCT.

Testing performed:

In both Firefox and Chrome:

  • Opened www.google.com/, checked the length of treeInterceptorHandler.runningTable was 1.
  • Refreshed the page. Made sure that length of runningTable was still 1.
  • Opened another 24 tabs to google.com. Validated that the length of runningTable was now 25.
  • Timed treeInterceptorHandler.cleanup, noting that before the change it was 70 ms on my machine, but with the change now down to 5 ms.
  • Closed each tab in turn, occasionally validating that length of runningTable was decreasing.
  • Closed the browser and validated that runningTable was 0.

Change log entry:

Bug fixes:

  • NVDA no longer becomes noticeably slower when many tabs are open in either Firefox or Chrome web browsers.

…ed-up by no longer calling AccessibleObjectFromevent, and calling IAccessible2::States directly to check for defunct. A COMError when calling IAccessible2::States (such as with Chrome) is treated as the object also being defunct as it is truely dead or disconnected.
@derekriemer

Copy link
Copy Markdown
Collaborator

shouldn't this be a 4x speed up, in the whats new instead of a 1/4x speedup?

@michaelDCurran

Copy link
Copy Markdown
Member Author

Where does it say 1/4? It should actually be 14.

@derekriemer

Copy link
Copy Markdown
Collaborator

Oh, I sware the title was 1/4 speed up Lol

@michaelDCurran michaelDCurran merged commit e54ae82 into master Aug 29, 2017
@nvaccessAuto nvaccessAuto added this to the 2017.4 milestone Aug 29, 2017
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

Successfully merging this pull request may close these issues.

Over time, NVDA lags with firefox open

4 participants