Introduction To profilers
Let's explore the functions of the profile and cProfile module.
We'll cover the following
Python comes with its own code profilers built-in. There is the
profile
module and the cProfile
module. The profile
module is pure Python, but it will add a lot of overhead to anything we profile, so it’s usually recommended that we go with cProfile
, which has a similar interface but is much faster.
Simple example of cProfile
We’re not going to go into a lot of detail about this module in this chapter, but let’s look at a couple of fun examples so we get a taste for what it can do.
Get hands-on with 1400+ tech skills courses.