commit f75b0c9f47ea4932cbdfea888cab55af7397c5a6 Author: Damian Johnson atagar@torproject.org Date: Wed Apr 27 09:41:40 2011 -0700
Delaying connection resolution until after init
This is a huge performance fix, dropping the startup time from 0.84 seconds to 0.14 (83% improvement). Arm had been fetching connection contents on init, blocking the first redraw. The fix is to both move connection init into its runtime thread *and* delay its execution until after the initial redraw. This hides the call latency in the period that we're usually waiting for user input anyway.
There's still perceived latency if the user immediately switches to the connections page, but this is both unavoidable and unusual. --- src/cli/connections/connPanel.py | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/src/cli/connections/connPanel.py b/src/cli/connections/connPanel.py index 8339f88..7e12232 100644 --- a/src/cli/connections/connPanel.py +++ b/src/cli/connections/connPanel.py @@ -71,9 +71,6 @@ class ConnectionPanel(panel.Panel, threading.Thread): # rate limits appResolver queries to once per update self.appResolveSinceUpdate = False
- self._update() # populates initial entries - self._resolveApps(False) # resolves initial applications - # mark the initially exitsing connection uptimes as being estimates for entry in self._entries: if isinstance(entry, connEntry.ConnectionEntry): @@ -170,6 +167,16 @@ class ConnectionPanel(panel.Panel, threading.Thread): """
lastDraw = time.time() - 1 + + # Fetches out initial connection results. The wait is so this doesn't + # run during arm's interface initialization (otherwise there's a + # noticeable pause before the first redraw). + self._cond.acquire() + self._cond.wait(0.2) + self._cond.release() + self._update() # populates initial entries + self._resolveApps(False) # resolves initial applications + while not self._halt: currentTime = time.time()
tor-commits@lists.torproject.org