Lower tabbar cache bound and clean up code

This commit is contained in:
Jay Kamat 2017-10-24 10:18:10 -04:00
parent 49daa7aab8
commit cb6f4313d7
No known key found for this signature in database
GPG Key ID: 5D2E399600F4F7B5
2 changed files with 5 additions and 2 deletions

View File

@ -463,13 +463,13 @@ class TabBar(QTabBar):
icon_width, icon_width,
ellipsis) ellipsis)
@functools.lru_cache(maxsize=2**10) @functools.lru_cache(maxsize=2**9)
def _minimum_tab_size_hint_helper(self, tab_text: str, def _minimum_tab_size_hint_helper(self, tab_text: str,
icon_width: int, icon_width: int,
ellipsis: bool) -> QSize: ellipsis: bool) -> QSize:
"""Helper function to cache tab results. """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. ensure cache is flushed when needed.
""" """
text = '\u2026' if ellipsis else tab_text text = '\u2026' if ellipsis else tab_text

View File

@ -171,6 +171,7 @@ def debug_cache_stats():
prefix_info = configdata.is_valid_prefix.cache_info() prefix_info = configdata.is_valid_prefix.cache_info()
# pylint: disable=protected-access # pylint: disable=protected-access
render_stylesheet_info = config._render_stylesheet.cache_info() render_stylesheet_info = config._render_stylesheet.cache_info()
# pylint: enable=protected-access
history_info = None history_info = None
try: try:
@ -183,8 +184,10 @@ def debug_cache_stats():
tabbed_browser = objreg.get('tabbed-browser', scope='window', tabbed_browser = objreg.get('tabbed-browser', scope='window',
window='last-focused') window='last-focused')
# pylint: disable=protected-access
tabbed_browser_info = tabbed_browser.tabBar(). \ tabbed_browser_info = tabbed_browser.tabBar(). \
_minimum_tab_size_hint_helper.cache_info() _minimum_tab_size_hint_helper.cache_info()
# pylint: enable=protected-access
log.misc.debug('is_valid_prefix: {}'.format(prefix_info)) log.misc.debug('is_valid_prefix: {}'.format(prefix_info))
log.misc.debug('_render_stylesheet: {}'.format(render_stylesheet_info)) log.misc.debug('_render_stylesheet: {}'.format(render_stylesheet_info))