diff options
author | Lars Wirzenius <liw@liw.fi> | 2015-10-10 11:57:02 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2015-10-10 12:03:08 +0300 |
commit | 78a211f249d3a70c4c3322abe616cded5a7e085b (patch) | |
tree | c1798319e193df78a4afa8aa0276d767152b5304 /ttystatus/messager.py | |
parent | 9b5ba7f23fe584f5807fea183070cee7594898e1 (diff) | |
download | python-ttystatus-78a211f249d3a70c4c3322abe616cded5a7e085b.tar.gz |
Improve speed when output is disabled
There's no point in trying to render if output isn't happening.
This brings benchmark time from about 26 seconds to 7.
Diffstat (limited to 'ttystatus/messager.py')
-rw-r--r-- | ttystatus/messager.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ttystatus/messager.py b/ttystatus/messager.py index 8743561..00b05d1 100644 --- a/ttystatus/messager.py +++ b/ttystatus/messager.py @@ -60,6 +60,10 @@ class Messager(object): '''Enable output to happen.''' self._enabled = True + def is_enabled(self): + '''Is output enabled?''' + return self._enabled + def time_to_write(self): '''Is it time to write now?''' return self._now() - self._previous_write_at >= self._period |