Skip to main content Skip to navigation

Accelerating Python

Python has many advantages as a programming language, especially for quick prototypes and proofs of concept. Often though, with a little work these programs can be optimised: particularly important if they are to be used repeatedly for long-running calculations. In some cases run times can be reduced from days to hours or better.
This workshop starts with profiling, to find out which parts of the code are taking the most time and then discusses some ways of speeding up code, while keeping a user-friendly Python interface. Perhaps most importantly we try to do this while keeping a working code at all times, so you can keep doing research. We demonstrate with real examples of numerical problems, such as matrix calculations and planetary orbits.


Part 1 - Motivation and Profiling Basics (Updated for December 2021)
Part 2/3 - Making Python Faster And Tricks with Libraries (Updated for December 2021)
Part 3 (continued) - The Numba Library (No changes needed for December 2021)
Part 4 - External Code calls (No changes needed for December 2021)

Video Lecture

A recording of the material as given in March 2020 is available here:

USE THIS LINK FOR CURRENT SESSION The livestream for December 2021 is available at

Example Code

See our github page here

Livestream Instructions (December 2021)

For convenience, this course will be run as a live stream with discussion sessions

Live stream link:

Comments are enabled for this stream - you will need a YouTube account (or other Google account) if you wish to comment and the stream is NOT private - take care with identifying information! We will try and answer all comments ASAP. If you have any trouble commenting for any reason, we'll monitor email too.

We plan to have an afternoon assistance session via video conference. The link for this will be available here on the day, and also available in the livestream.