Performant Python
An introduction to writing performant Python code - the "what, why, where, when and many how's" of performance analysis, testing, tools and techniques.
See this talk and many more by getting your ticket to PyCon AU now!
I want a ticket!Why, as Python developers, should we care about writing performant code? Python doesn't have a great reputation when it comes to performance, but this does not need to be the case! In this talk we will cover: - What do you mean by 'Performant'? We'll talk briefly about the different metrics that can measure the performance of software, and the history of performance in Python. - Why, Where and When? Performance should be an important consideration in the code we write and distribute, however performance analysis and improvement can be a time-consuming endevour, so we will look at how to identify where this time is best invested, and why. - How do I start? There are many tools available; libraries, IDE extensions, command line tools, and of course, within the Python standard library, so we will explore options and what benefits each provides. - How do I find issues? Trying to improve the performance of code is not like regular debugging - we will look at how to use these tools to identify problem areas in the code by looking through some examples. - How do I fix it? There's always more than one solution to a performance problem. We'll look at how our example issues could be mitigated and the pros and cons of varying approaches, including the use of compiled extensions. - How do I know when I'm finished? Is my code performant enough? Improving performance can be highly iterative, with changes yielding only minor incremental improvements. We will talk about some of the challenges in determining success criteria, and trying to cost estimate performance work.
This talk will touch on some more advanced Python syntax, as well as peeking into how the Python language works, so some basic coding experience is assumed. However, the topics and techniques discussed will be applicable to developers of all levels.
Some things we won't cover: - High-level architecture for high performance systems. This talk will mostly focus on lower-level code structure and syntax. - C/Rust extensions will not be covered in detail in this talk, however we will take a look at identifying when an extension could be a good fit to solving performance problems, and the pros and cons of this approach. - In this talk we will focus on the execution time of CPU-bound code as the measure of performance, so we won't discuss other performance metrics, such as memory usage or IO traffic.
I have been a Python developer for over 10 years, based between Wellington, New Zealand and Redmond, Washington. For over six of those years, I have been working for Microsoft on the Azure SDK for Python.