Optimizing code with Cython and Numba

In this recipe, we will look at a short introduction on how to optimize code with Cython and Numba. These are competitive approaches; Cython is a superset of Python that allows you to call C functions and specify C types. Numba is a just-in-time compiler that optimizes the Python code.

As an example, we will reuse the distance recipe from Chapter 7, Using the Protein Data Bank. We will compute the distance between all of the atoms in a PDB file.

Get Bioinformatics with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.