Saturday 4:30 p.m.–5 p.m. in Room 26A/B/C

Python Performance Investigation by Example

Matt Davis


Occasionally we’ll find that some bit of Python we’ve written doesn’t run as fast as we’d like, what can we do? Performance bottlenecks aren’t always intuitive or easy to spot by reading code so we need to collect data with [profiling]( Once we’ve identified the bottleneck we’ll need to change our approach, but what options are faster than others? This talk illustrates a Python performance investigation and improvements using an [Advent of Code]( programming challenge. I’ll walk through starting from a slow (but correct) solution, look at profiling data to investigate _why_ it’s slow, and explore multiple paths for improving performance, including more efficient algorithms and using third-party tools like [Cython]( You’ll leave this talk with a recipe for analyzing Python performance and information about some options for improved performance.