On Ubuntu 16.04, with Python 2.7, performance impact is non-trivial
anandr165 opened this issue · comments
Without adding hook to my module (tgv):
Traceback (most recent call last):
File "./tgv.py", line 618, in
if name == "main": tgv()
File "./tgv.py", line 426, in tgv
1/0
ZeroDivisionError: integer division or modulo by zero
real 0m2.904s
user 0m2.344s
sys 0m0.536s
With hook added
Traceback (most recent call last):
File "./tgv.py", line 618, in
if name == "main": tgv()
<6 variables printed>
File "./tgv.py", line 426, in tgv
1/0
<20 odd variables>
ZeroDivisionError: integer division or modulo by zero
real 0m30.856s
user 0m29.192s
sys 0m1.572s
I'm guessing mostly the perf degradation is due to the high count of variables being printed.
Anyway to control the output?
Hmm, does it really print that many variables? The goal is to print enough to be relevant, not to inundate the user. Can you post a sample of the output?
Sorry I cant print the details but more than half the variables are lists & dictionaries of nearly 100,000 entries of small strings.
To improve the performance of printing large variables, I suggest https://github.com/alexmojaki/cheap_repr