Building a new tail-calling interpreter for Python

Track:
Python Core, Internals, Extensions
Type:
Talk
Level:
advanced
Duration:
30 minutes

Abstract

CPython (the reference implementation of Python) comes with two types of interpreters. One interpreter is based on the traditional switch-case in C, while the other one uses a fancy feature called computed gotos. In this talk, I'll cover how I am implementing a new type of interpreter for CPython --- one based on tail calls. Preliminary benchmarks for this new interpreter suggest up to a 7% performance improvement on Python-heavy programs, with significantly better external debugging experience. This interpreter is already a part of Python 3.14.