Skip to content

Commit 2166b57

Browse files
Glandoskeszybz
authored andcommitted
journal: remove ChainMap
"after some quick testing, the execution time got halved (32-ish seconds to 16-ish seconds) when going through all journal entries." Closes #63.
1 parent 9cbc4e9 commit 2166b57

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

systemd/journal.py

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@
2828
import logging as _logging
2929
from syslog import (LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR,
3030
LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG)
31-
if _sys.version_info >= (3,3):
32-
from collections import ChainMap as _ChainMap
3331

3432
from ._journal import __version__, sendv, stream_fd
3533
from ._reader import (_Reader, NOP, APPEND, INVALIDATE,
@@ -172,15 +170,9 @@ def __init__(self, flags=None, path=None, files=None, converters=None, namespace
172170
flags = 0
173171

174172
super(Reader, self).__init__(flags, path, files, namespace)
175-
if _sys.version_info >= (3, 3):
176-
self.converters = _ChainMap()
177-
if converters is not None:
178-
self.converters.maps.append(converters)
179-
self.converters.maps.append(DEFAULT_CONVERTERS)
180-
else:
181-
self.converters = DEFAULT_CONVERTERS.copy()
182-
if converters is not None:
183-
self.converters.update(converters)
173+
self.converters = DEFAULT_CONVERTERS.copy()
174+
if converters is not None:
175+
self.converters.update(converters)
184176

185177
def _convert_field(self, key, value):
186178
"""Convert value using self.converters[key].

0 commit comments

Comments
 (0)