From cb6f4313d7e74d1cf8ab7152958b617fad34c882 Mon Sep 17 00:00:00 2001 From: Jay Kamat Date: Tue, 24 Oct 2017 10:18:10 -0400 Subject: [PATCH] Lower tabbar cache bound and clean up code --- qutebrowser/mainwindow/tabwidget.py | 4 ++-- qutebrowser/misc/utilcmds.py | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py index 4f2e33034..67d138fd4 100644 --- a/qutebrowser/mainwindow/tabwidget.py +++ b/qutebrowser/mainwindow/tabwidget.py @@ -463,13 +463,13 @@ class TabBar(QTabBar): icon_width, ellipsis) - @functools.lru_cache(maxsize=2**10) + @functools.lru_cache(maxsize=2**9) def _minimum_tab_size_hint_helper(self, tab_text: str, icon_width: int, ellipsis: bool) -> QSize: """Helper function to cache tab results. - Acessing config values in here should be added to _on_config_changed to + Config values accessed in here should be added to _on_config_changed to ensure cache is flushed when needed. """ text = '\u2026' if ellipsis else tab_text diff --git a/qutebrowser/misc/utilcmds.py b/qutebrowser/misc/utilcmds.py index e4c4fc033..07949b771 100644 --- a/qutebrowser/misc/utilcmds.py +++ b/qutebrowser/misc/utilcmds.py @@ -171,6 +171,7 @@ def debug_cache_stats(): prefix_info = configdata.is_valid_prefix.cache_info() # pylint: disable=protected-access render_stylesheet_info = config._render_stylesheet.cache_info() + # pylint: enable=protected-access history_info = None try: @@ -183,8 +184,10 @@ def debug_cache_stats(): tabbed_browser = objreg.get('tabbed-browser', scope='window', window='last-focused') + # pylint: disable=protected-access tabbed_browser_info = tabbed_browser.tabBar(). \ _minimum_tab_size_hint_helper.cache_info() + # pylint: enable=protected-access log.misc.debug('is_valid_prefix: {}'.format(prefix_info)) log.misc.debug('_render_stylesheet: {}'.format(render_stylesheet_info))