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/funcs.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/funcs.py')
-rw-r--r-- | src/windows/funcs.py | 4 |
1 files changed, 1 insertions, 3 deletions
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: |