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

Massively improve performance navigating Excel spreadsheets containing comments or dropdowns #8019

Closed
wants to merge 8 commits into from

Conversation

michaelDCurran
Copy link
Member

@michaelDCurran michaelDCurran commented Feb 21, 2018

Link to issue number:

Closes #7348

Summary of the issue:

When an Excel spreadsheet contains one or more comments or data validation dropdowns, most if not all object model calls on cell ranges cause the screen to be redrawn which results in a huge slowdown when moving between cells with NVDA.
This is made even worse if the window is maximized as more screen realestate must be refreshed for each call.
In short, if a spreadsheet contains comments or data validation dropdowns, it is almost impossible to navigate the spreadsheet.

Description of how this pull request fixes the issue:

For both focus events and changeSelection scripts on Excel spreadsheets, NVDA now disables Excel's screen updating for the duration of the event/script. The changeSelection script has also been rewritten slightly to ensure the best performance when moving by one or two cells, but at the same time, not cause a major lag when quickly moving through many.

Testing performed:

In Excel 2016:

  • Navigated several spreadsheets. Some containing comments, some containing dropdowns, and some containing neither.
    Earlier versions of Excel should be also tested, though I expect any added calls are certainly available in Excel 2007 or higher.

Known issues with pull request:

This is really just a temporary solution. We should very soon consider switching to using UIA in Excel 2016. It would be also nice if Microsoft were able to address the underlying object model bug.

Change log entry:

Bug fixes:

  • A significant lag is no longer experienced when navigating cells in Excel spreadsheets containing comments or dropdowns.

… that can pass before the same script executed is not classed as the script repeating) via a 'repeatTimeout' attribute on the script. If not provided scripts default to 0.5 seconds as was previously the case.
…ls, such as for focus events and changing selection. This massively speeds up performance when navigating a spreadsheet with comments or dropdowns.
@@ -184,6 +186,14 @@ def executeScript(script,gesture):
_lastScriptCount=0
_lastScriptRef=scriptRef
_lastScriptTime=scriptTime
scriptRepeatTimeout=getattr(scriptFunc,'repeatTimeout',0.5)
print "Script set repeatTimeout of %s"%scriptRepeatTimeout
Copy link
Collaborator

Choose a reason for hiding this comment

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

Debug code.

@michaelDCurran
Copy link
Member Author

@derekriemer: I addressed your review action.

feerrenrut
feerrenrut previously approved these changes Mar 7, 2018
@@ -184,6 +186,13 @@ def executeScript(script,gesture):
_lastScriptCount=0
_lastScriptRef=scriptRef
_lastScriptTime=scriptTime
scriptRepeatTimeout=getattr(scriptFunc,'repeatTimeout',0.5)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since 0.5 is used in 3 places, it might makes sense to put this in a _defaultScriptRepeatSeconds variable.

if oldSelection.parent==newSelection.parent:
# Detect if this script is being repeated a lot (E.g. held down)
repeated=scriptHandler.getLastScriptRepeatCount()>2
if repeated and scriptHandler.isScriptWaiting():
Copy link
Contributor

Choose a reason for hiding this comment

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

Previously this was done in the while loop until the timeout, is this moved out since we expect this script to get called again? How do we know that this script will be called again?

michaelDCurran added a commit that referenced this pull request Mar 8, 2018
@michaelDCurran
Copy link
Member Author

In the end I realised that the changes to scriptHandler were flawed as one of the checks for lastScriptRepeatTimeout were missing and still hardcoded to 0.5. Thus all my other testing was incorrect. Re-testing things seem to be okay without it. Let's see how well it goes in Next for a while.

michaelDCurran added a commit that referenced this pull request Mar 28, 2018
derekriemer
derekriemer previously approved these changes Apr 4, 2018
@michaelDCurran
Copy link
Member Author

This causes other lags in Excel and therefore is not a suitable solution to the original issue. Removed from next and closing for now. Will try a different direction.

@michaelDCurran michaelDCurran dismissed stale reviews from derekriemer and feerrenrut via 235c924 July 20, 2018 07:41
@gregjozk
Copy link
Contributor

what's the difference between this PR and #9257?
thx

@michaelDCurran
Copy link
Member Author

This was replaced by #9257.

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

Successfully merging this pull request may close these issues.

Extremely slow navigating between cells in MS Excel 2016 when a cell contains a comment or dropdown
6 participants