commit/goldwave: josephsl: Performance improvements when fetching status items via obj.getChild.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Mon, 27 Jun 2016 05:23:17 -0000

1 new commit in goldwave:

https://bitbucket.org/nvdaaddonteam/goldwave/commits/95cadb8d3a7b/
Changeset:   95cadb8d3a7b
Branch:      master
User:        josephsl
Date:        2016-06-27 05:22:42+00:00
Summary:     Performance improvements when fetching status items via 
obj.getChild.

According to Jamie Teh (NV Access), when looking for a specific child, it is 
faster to use obj.getChild(index) instead of obj.children[index]. Subsequent 
test shows it is indeed the case - up to four times faster than before. This 
means performance improvements when fetching information such as channels, 
selection duration and others.
This is destined for add-on 4.0 (later in summer).

Affected #:  1 file

diff --git a/addon/appModules/goldwave.py b/addon/appModules/goldwave.py
index fb59807..907219e 100755
--- a/addon/appModules/goldwave.py
+++ b/addon/appModules/goldwave.py
@@ -42,7 +42,7 @@ class SoundWindow(IAccessible):
                        fgChild.redraw()
                #fgChild = self.appModule._get_statusBars(statBarIndex, 
refill=True)
                try:
-                       info = fgChild.children[childIndex].displayText
+                       info = fgChild.getChild(childIndex).displayText
                except IndexError:
                        return ""
                return info
@@ -60,7 +60,7 @@ class SoundWindow(IAccessible):
                # Current cursor position.
                if not fgChild.displayText:
                        fgChild.redraw()
-               audioPos = fgChild.children[3].displayText.replace('\t', '')"""
+               audioPos = fgChild.getChild(3).displayText.replace('\t', '')"""
                # Translators: Presented when audio track position information 
can not be located.
                return _("Track position not available") if not audioPos or " " 
in audioPos else audioPos
 
@@ -74,7 +74,7 @@ class SoundWindow(IAccessible):
                except AttributeError:
                        fgChild = self.appModule._get_statusBars(0, refill=True)
                try:
-                       audioSelection = fgChild.children[2].displayText
+                       audioSelection = fgChild.getChild(2).displayText
                except IndexError:
                        pass"""
                return audioSelection
@@ -126,7 +126,7 @@ class SoundWindow(IAccessible):
                except AttributeError:
                        fgChild = self.appModule._get_statusBars(0, refill=True)
                try:
-                       audioChannels = fgChild.children[0].displayText
+                       audioChannels = fgChild.firstChild.displayText
                except IndexError:
                        return"""
                return audioChannels
@@ -137,7 +137,7 @@ class SoundWindow(IAccessible):
                        if not fgChild.displayText: fgChild.redraw()
                except AttributeError:
                        fgChild = self.appModule._get_statusBars(0)
-               trackLength = fgChild.children[1].displayText
+               trackLength = fgChild.getChild(1).displayText
                return trackLength
 
        # Convert time to seconds: Convert hh:mm:ss to seconds.
@@ -185,7 +185,7 @@ class SoundWindow(IAccessible):
                        if not fgChild.displayText: fgChild.redraw()
                except AttributeError:
                        fgChild = self.appModule._get_statusBars(1, refill=True)
-               zoomLevel = fgChild.children[1].displayText"""
+               zoomLevel = fgChild.getChild(1).displayText"""
                return zoomLevel
 
        # Audio editing scripts:

Repository URL: https://bitbucket.org/nvdaaddonteam/goldwave/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.

Other related posts:

  • » commit/goldwave: josephsl: Performance improvements when fetching status items via obj.getChild. - commits-noreply