diff options
author | Anthon van der Neut <anthon@mnt.org> | 2016-11-22 09:24:43 +0100 |
---|---|---|
committer | Anthon van der Neut <anthon@mnt.org> | 2016-11-22 09:24:43 +0100 |
commit | 77559065be3f3e8a76d76e733c26bb9a149f7b42 (patch) | |
tree | 37bb94598d77b0eb879bb958c7dad76f7f51fc8f /compat.py | |
parent | a72e8cf2f64855d29106f4f5b1687e09bcc9284e (diff) | |
download | ruamel.yaml-77559065be3f3e8a76d76e733c26bb9a149f7b42.tar.gz |
memory usage optimisations0.13.1
Diffstat (limited to 'compat.py')
-rw-r--r-- | compat.py | 14 |
1 files changed, 14 insertions, 0 deletions
@@ -101,6 +101,20 @@ DBG_NODE = 4 _debug = None +if _debug: + class ObjectCounter(object): + def __init__(self): + self.map = {} + + def __call__(self, k): + self.map[k] = self.map.get(k, 0) + 1 + + def dump(self): + for k in sorted(self.map): + print(k, '->', self.map[k]) + + object_counter = ObjectCounter() + # used from yaml util when testing def dbg(val=None): |