
Learn to measure Python program execution time with the time module by recording a start time and end time, subtracting to get duration, illustrated with long-running operations like large-number addition.
Learn to profile python functions with C profile, a default module that measures a function's execution time and outputs call details, offering an alternative to the time module.
Discover how Python is an interpreted language, so execution speed depends on the interpreter; compare different Python versions to squeeze small performance gains.
Explore how CPython and PyPy affect execution time, and learn to run Python with pypy3 via a package manager on Linux, Windows, or Mac.
Explore Python built-in functions like map that apply a function to every item in a list. This approach can speed up code compared with explicit loops.
Choose built-in functions to speed up Python code, as using length and other standard functions outperforms manual loops across CPython and other interpreters.
Compare a for loop and a list comprehension to generate cubes of odd numbers, showing list comprehension is faster as data grows from 10 to 1000 items.
Importing modules slows code; import only needed functions with from module import function1, function2 to reduce execution time.
Explore how Python concatenates strings using the plus operator versus the join function, and learn that the join function offers faster performance for large word lists when aggregating with commas.
Discover how calling C functions from Python by compiling a library and loading the shared library via the C types module can dramatically speed up computations versus pure Python.
Python is an interpreted, object-oriented programming language. it incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. python combines remarkable power with very clear syntax.
Despite it's popularity, it's often accused of being slow. In this course you will learn how to optimize the performance of your Python code. You will learn various tricks to reduce execution time.
A lot of people have different definitions of performance. When I say “performance”, I’m talking about:
How quickly does the code execute? Meaning how long until the output is returned?
Of course, there are other metrics for measuring the performance of a system, but this code has a focus on speed.
The faster your code executes, the better it is. Who has time to wait for computer execution? Especially when it's not necessary. If you come from another programming language, you may not know about some ways to speed up your Python code. If you are a Python coder, you may not know about these tricks either.
If you already know Python and want to optimize your code or increase your Python skills, this course is for you. This is an intermediate course, you should already know how to write Python code. But if you are a beginner with prior programming experience, you might be able to follow along with all the concepts explained in this course.