diff options
author | mathieui <mathieui@mathieui.net> | 2015-05-08 20:37:21 +0200 |
---|---|---|
committer | mathieui <mathieui@mathieui.net> | 2015-05-08 20:37:21 +0200 |
commit | dfd60426d8da06c817c6d3f71901b4f1c013a819 (patch) | |
tree | 79fb8cf31b623cdd846311a0761b34a7b6cfb549 /src/windows/info_bar.py | |
parent | 3171c96eed40d24b3200a8f2af1da9bc7619ab39 (diff) | |
download | poezio-dfd60426d8da06c817c6d3f71901b4f1c013a819.tar.gz poezio-dfd60426d8da06c817c6d3f71901b4f1c013a819.tar.bz2 poezio-dfd60426d8da06c817c6d3f71901b4f1c013a819.tar.xz poezio-dfd60426d8da06c817c6d3f71901b4f1c013a819.zip |
Micro-optimizations on refresh
Reduce the number of calls to config.get whenever possible. Yields a
performance improvement of at least 10% for the basic use case of
"receiving a message in the current tab". Logging stuff isn’t free
either, even when the call should be a no-op, so we should try to make
the debug log less verbose.
Diffstat (limited to 'src/windows/info_bar.py')
-rw-r--r-- | src/windows/info_bar.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/windows/info_bar.py b/src/windows/info_bar.py index e66343c5..abd956cd 100644 --- a/src/windows/info_bar.py +++ b/src/windows/info_bar.py @@ -28,6 +28,7 @@ class GlobalInfoBar(Win): show_names = config.get('show_tab_names') show_nums = config.get('show_tab_numbers') use_nicks = config.get('use_tab_nicks') + show_inactive = config.get('show_inactive_tabs') # ignore any remaining gap tabs if the feature is not enabled if create_gaps: sorted_tabs = self.core.tabs[:] @@ -37,8 +38,7 @@ class GlobalInfoBar(Win): for nb, tab in enumerate(sorted_tabs): if not tab: continue color = tab.color - if not config.get('show_inactive_tabs') and\ - color is get_theme().COLOR_TAB_NORMAL: + if not show_inactive and color is get_theme().COLOR_TAB_NORMAL: continue try: if show_nums or not show_names: @@ -87,9 +87,10 @@ class VerticalGlobalInfoBar(Win): sorted_tabs = sorted_tabs[-height:] else: sorted_tabs = sorted_tabs[pos-height//2 : pos+height//2] + asc_sort = (config.get('vertical_tab_list_sort') == 'asc') for y, tab in enumerate(sorted_tabs): color = tab.vertical_color - if not config.get('vertical_tab_list_sort') != 'asc': + if asc_sort: y = height - y - 1 self.addstr(y, 0, "%2d" % tab.nb, to_curses_attr(get_theme().COLOR_VERTICAL_TAB_NUMBER)) |