Profiling Performance in Python: Getting Started & Benchmarking Code Snippets

Опубликовано: 14 July 2026
на канале: Real Python
1,345
58

This is a preview of the video course, "Profiling Performance in Python". Do you want to optimize the performance of your Python program to make it run faster or consume less memory? Before diving into any performance tuning, you should strongly consider using a technique called software profiling. It can help you decide whether optimizing the code is necessary and, if so, which parts of the code you should focus on. Sometimes, the return on investment in performance optimizations just isn’t worth the effort. If you only run your code once or twice, or if it takes longer to improve the code than execute it, then what’s the point?

This is a portion of the complete course, which you can find here:
https://realpython.com/courses/profil...

The rest of the course covers:
Collecting Detailed Runtime Statistics With cProfile
Formatting Collected Runtime Statistics With pstats
Taking Snapshots of the Call Stack Using Pyinstrument