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

Optimize elements list filtering to retrieve an element label only once #6126

Merged

Conversation

LeonarddeR
Copy link
Collaborator

@LeonarddeR LeonarddeR commented Jun 30, 2016

As discussed in this thread on nvda-devel:

What do you think about the following though, related to the elements list? IN browseMode.ElementsListDialog.filter, label is called twice in every for element in self._elements loop, namely:

  • if filterText and filterText not in element.item.label.lower():
  • item = self.tree.AppendItem(parent or self.treeRoot, element.item.label)

I'd like to suggest create a local label variable which contains element.item.label, and than do the returning and filtering with that variable. This will, if I understand it correctly, call element.item.label only once instead of twice, which can improve performance on complex label generation as in virtualBuffers.VirtualBufferQuickNavItem.label.

michaelDCurran added a commit that referenced this pull request Jul 6, 2016
@michaelDCurran michaelDCurran merged commit 1c25da5 into nvaccess:master Jul 24, 2016
@jcsteh jcsteh added this to the 2016.3 milestone Aug 5, 2016
@LeonarddeR LeonarddeR added the BabbageWork Pull requests filed on behalf of Babbage B.V. label Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BabbageWork Pull requests filed on behalf of Babbage B.V.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants