skorokithakis / tbvaccine

A small utility to pretty-print Python tracebacks. ⛺
MIT License
377 stars 14 forks source link

On Ubuntu 16.04, with Python 2.7, performance impact is non-trivial #27

Open anandr165 opened 5 years ago

anandr165 commented 5 years ago

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?
skorokithakis commented 5 years ago

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?

anandr165 commented 5 years ago

Sorry I cant print the details but more than half the variables are lists & dictionaries of nearly 100,000 entries of small strings.

alexmojaki commented 3 years ago

To improve the performance of printing large variables, I suggest https://github.com/alexmojaki/cheap_repr