Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
vik748 opened this issue Jan 10, 2024 · 1 comment

Comments

@vik748
Copy link

vik748 commented Jan 10, 2024

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?

@mvanholsteijn
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants