Please read our student and staff community guidance on COVID-19
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
Part 2/3 - Making Python Faster And Tricks with Libraries
Part 3 (continued) - The Numba Library
Part 4 - External Code calls

Video Lecture

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

Example Code

See our github page here

Livestream Instructions (March 2020)

Due to current University policy, this workshop will be given via live stream for the March 20th 2020 date. We plan to start at 10am and end at 4pm as expected, with breaks and a lunch break. Please excuse any bugs in the process, as this is a trial run at somewhat short notice.

Live stream link: (now links to recording of stream)

Comments are enabled for this stream - you will need a YouTube account (or other Google account) 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.

For breaks, and for the afternoon assistance session, we plan to use online Video Conferencing. We'll announce the url for this via the stream/email at the time. You should have received the password for this call by email. This stream should be private, but do take the usual care about identifying information.