Profiling 101 for Python Developers: Using Blackfire 6/6
This article is the last of a series of six on Profilers in the Python world, and how Blackfire is the best-of-breed tool to introspect code behavior and optimize its performance.
Blog post series index:
- What is a Profiler?
- The Many Types of Profilers
- List of Existing Python Profilers
- Picking the Right Profiler
- Profiles visualizations
- Using Blackfire (you are here)
This series of article walked through the various types of profiling technologies, trying to give an overview of what exists, and the pros and cons.
Blackfire is hard at work on finding the best trade-offs for optimal accuracy, with the lowest intrinsic performance consumption. Let’s look back at the key benefits compared to other solutions in the Python world:
- Easy installation and use, with no instrumentation needed
- SaaS, enabling to benefit instantaneously from any web UI and features improvements
- No overhead for end users
- Complementary (appealing) call-graph and timeline visualizations
- Built for collaboration and seamless profiling information sharing within teams
At the time of writing, Blackfire for Python is in Beta. Expect this list to increase in the coming weeks and month, as we aim at offering Python developers the same service than we do for PHP developers. Check our docs to discover our many features and ways to inspect your code for performance, security and quality improvements!
Time is just a consequence
As a last word in this series, it is key to understand this core principle in profiling. Time is just a consequence of what happened in the code.
It is not a stable metric, as it can be influenced by many factors, such as the server load.
A time value, on its own, isn’t actionable.
How to determine whether it’s actually “good” or “bad”? As opposed to what?
Also, the amount of data handled by the code can also have significant impact. Profiles generated on a local machine with test data may show nice time results, and much slower ones when in production with real data.
Profile. Understand the code’s behavior. Compare. This is the process to optimization.