Book Image

Mastering PyCharm

By : Nafiul Islam
Book Image

Mastering PyCharm

By: Nafiul Islam

Overview of this book

Table of Contents (18 chapters)
Mastering PyCharm
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Profiling


Profiling is a new addition to PyCharm 4.5, and has a nice set of features, most notably, a graphic representation of the calls made. We are going to use the previously mentioned downloader.py file to demonstrate some of the new features.

We simply right-click anywhere on the file and then left-click on Profile 'downloader'. With this, we will be taken to a new panel that shows us a call table.

We can also see that if we choose to, we can jump to both the source and the call graph. The call graph is a graphical representation of what functions are being called where and their impact; green means small impact and red means high impact. This is really quite useful since we can optimize slow code on the spot if the optimization is simple.

Furthermore, the call graph gives us a nice colorized hierarchical representation of function calls.

We can also export the graph files for others to see. If we right-click on any of the call blocks in the call graph, we can jump to the source.