Using cProfile Preferred Profiler

suggest change

Python includes a profiler called cProfile. This is generally preferred over using timeit. They answer different questions: cProfile breaks down a script, and timeit times a single statement.

It breaks down your entire script and for each function in your script it tells you:

cProfile can be called from the command line:

$ python -m cProfile main.py

To sort the returned list of profiled functions by the time spent inside each function:

$ python -m cProfile -s time main.py

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents