We're sorry but this page doesn't work properly without JavaScript enabled. Please enable it to continue.
Feedback

Opening PyPy's magic black box

Formal Metadata

Title
Opening PyPy's magic black box
Subtitle
A deep dive into the JIT
Title of Series
Number of Parts
118
Author
License
CC Attribution - NonCommercial - ShareAlike 3.0 Unported:
You are free to use, adapt and copy, distribute and transmit the work or content in adapted or unchanged form for any legal and non-commercial purpose as long as the work is attributed to the author in the manner specified by the author or licensor and the work or content is shared also in adapted form only under the conditions of this
Identifiers
Publisher
Release Date
Language

Content Metadata

Subject Area
Genre
Abstract
PyPy is a fast and compliant implementation of Python. In other words, it's an interpreter for the Python language that can act as a full replacement for the reference interpreter, CPython. It's optimised to enable efficient just-in-time (JIT) compilation of Python code to machine code, and has releases matching versions 2.7, and 3.6. It now also supports the main pillars of the scientific ecosystem (numpy, Cython, scipy, pandas, ...) thanks to its emulation layer for the C API of CPython. The PyPy JIT is often just described as ""magically running your code faster"", but is actually what is known as a ""meta-tracing JIT"". A tracing JIT optimises loops by recording and optimising a single, hopefully representative, execution of the loop. While crude, that approach is known to be effective for just-in-time compiler. Additionally, PyPy's JIT is ""meta"" in the sense that it traces the execution of the interpreter while it runs some user-code instead of tracing the user-code directly. This again simplifies the compiler. We will explore how all this works together and is implemented (spoiler: it's Python all the way down!). This talk assumes no prior knowledge of compiler theory nor of PyPy internals, and should be of interest to anybody who wishes that their pure-Python code would run faster. The audience will gain a firmer understanding of how PyPy operates and optimises code, and how to how to get the most out of the PyPy JIT.
Keywords