Skip to Content
Benchmarking, Profiling, and Optimizing Your Python Code: Easily Identify Bottlenecks and Efficiently Speed Up Your Python Code
on-demand course

Benchmarking, Profiling, and Optimizing Your Python Code: Easily Identify Bottlenecks and Efficiently Speed Up Your Python Code

with Coen de Groot
November 2020
Intermediate
1h 32m
English
Apress
Closed Captioning available in English

Overview

Some programmers don’t use Python because they think it is too slow. Yet writing fast-enough programs in Python often takes less time than in other languages. In this video, you will learn how to effectively and efficiently speed up your Python programs.

We start by looking at how to measure the speed of a program, so you can see the impact of your changes. And we will discover where your program spends most of its time to help you focus your efforts. You will see how to create performance graphs and drill down into the detail. Next, we move on to optimizing the code by changing the flow and structure. Some approaches take more processing power than others, and we will look at how to use code complexity to express this and help you choose the best algorithm. We will see some examples of switching to a different algorithm and the impact on the code’s speed. You will see some simple techniques to cache the results from your functions. Moving code out of large loops can also have a significant impact. Having restructured the code, you will learn how to speed up individual lines of code. We will look at ten common tasks in Python and compare the different ways to achieve them.

After watching this video, you will be able to measure code performance to see what works, profile your code to discover where to focus, change the code structure and flow to improve speed, and go through your code line by line to use faster Python syntax.

What You Will Learn
  • Benchmark Python code and track the progress of optimization efforts
  • Profile Python code and discover low-hanging fruit to focus your optimization
  • Change the code flow and structure to minimize how much code gets run
  • Choose the fastest Python syntax, line by line, to speed everything up
Who This Video Is For
Intermediate to experienced Python programmers who want to speed up existing Python code and write faster new Python code.




Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Watch now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Thinking in Pandas: How to Use the Python Data Analysis Library the Right Way

Thinking in Pandas: How to Use the Python Data Analysis Library the Right Way

Hannah Stepanek
Run Python in GitHub Actions

Run Python in GitHub Actions

Alfredo Deza, Noah Gift

Publisher Resources

ISBN: 9781484267769