codetiming icon indicating copy to clipboard operation
codetiming copied to clipboard

Can this library be used in production code, does it save all the timing values.

Open vik748 opened this issue 2 years ago • 1 comments

I am wondering if the Time class stores all the timing values it receives. I was intrigued since median computation would require something like that. If it does store it, does that mean the data structure grows unbounded?

vik748 avatar Jan 10 '24 18:01 vik748

TLDR; unless you explicitly call timer.timers.clear() it will grow unbounded.

https://github.com/realpython/codetiming/blob/main/codetiming/_timers.py#L24-L33

The Timers class is a class attribute of the Timer. It keeps a record of all starts and stops. So you need to clear it yourself every now and them.

mvanholsteijn avatar Jan 06 '25 16:01 mvanholsteijn