Skip to content

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

Merged
michaelDCurran merged 1 commit intonvaccess:masterfrom
LeonarddeR:optimize_elements_list_filter
Jul 24, 2016
Merged

Optimize elements list filtering to retrieve an element label only once#6126
michaelDCurran merged 1 commit intonvaccess:masterfrom
LeonarddeR:optimize_elements_list_filter

Conversation

@LeonarddeR
Copy link
Copy Markdown
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
@LeonarddeR LeonarddeR deleted the optimize_elements_list_filter branch August 23, 2025 06:25
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