From dfd60426d8da06c817c6d3f71901b4f1c013a819 Mon Sep 17 00:00:00 2001 From: mathieui Date: Fri, 8 May 2015 20:37:21 +0200 Subject: Micro-optimizations on refresh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/windows/funcs.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src/windows/funcs.py') diff --git a/src/windows/funcs.py b/src/windows/funcs.py index d58d4683..f1401628 100644 --- a/src/windows/funcs.py +++ b/src/windows/funcs.py @@ -4,7 +4,6 @@ Standalone functions used by the modules import string -from config import config from . base_wins import FORMAT_CHAR, format_chars def find_first_format_char(text, chars=None): @@ -19,8 +18,7 @@ def find_first_format_char(text, chars=None): pos = p return pos -def truncate_nick(nick, size=None): - size = size or config.get('max_nick_length') +def truncate_nick(nick, size=10): if size < 1: size = 1 if nick and len(nick) > size: -- cgit v1.2.3