Python: Measure Time and Memory
When debugging, I often want to measure a piece of code's performance/memory characteristics. I do this with the stdlib time class and psutil module. These are some snippets I always have in my utils before starting a project. Note: I use perf_counter (i.e performance counter clock) to measure time. For more details, see this. Measuring time and memory I use python's contextmanager to manage state. Realpython has a nice post on this....