postpile: the POST Python Compiler¶
postpile is a multi-backend ahead-of-time compiler for POST Python (Performance-Optimized Statically Typed Python). It lowers a typed Python subset through a backend-agnostic typed SSA IR to multiple native backends selectable at runtime, producing extension modules and shared libraries from typed kernels, or self-contained executables from whole scripts (ppc build --exe). Either artifact supports classes, containers, str, exceptions, a bidirectional CPython FFI, and the pygo concurrency surface, byte-identical to the interpreter across backends.
- Backends: C, QBE, and LLVM (via llvmlite) are registered and selectable;
--target wasm32-wasip1builds the C backend's output as WebAssembly, run in any WASI engine. - Selectable at runtime:
ppc build --backend {c,qbe,llvm}, thePOSTPILE_BACKENDenvironment variable, or thebackend=API argument. - Correctness by construction: every backend is held to a differential test oracle; its output must match CPython semantically and the C backend byte-for-byte where the arithmetic is exact.
postpile extends postpyc, the POST Python reference implementation created by Travis E. Oliphant and contributors, whose backend-agnostic typed SSA IR is the foundation this project stands on. postpyc lives on as the reference implementation and postpile's benchmark baseline. See ADR-0000 for the rationale and credits, and the language specification (a vendored copy of the canonical post-py.org spec).
The benchmark, in one table¶
Four numeric kernels measure postpile against the compilers you would otherwise use; each contender compiles equivalent source, identical files where the language allows (methodology and full tables):
| Compared with… | postpile is |
|---|---|
| CPython | ≈ 52× faster (geomean) |
| NumPy | ≈ 2× faster |
| Cython (typed memoryviews, checks off) | within 5% |
Numba (the same @vectorize decorator model) |
≈ 10% behind (all of it on matmul) |
| TurboPython (identical source files) | ahead on 3 of 3 kernels |
Taken 2026-11-11 on an Apple M1 under Python 3.12 with uv run nox -s bench_compare, in the build now called --release --unchecked; --release, which keeps the checks, runs these kernels within noise of it (2026-11-12). On whole programs, the thirteen of ADR 0067 against the same programs written in C, a compiled program takes 1.78× C's time on the C backend with the default growing int in --release (1.80× unchecked), and 1.22× with the 64-bit int (1.18× unchecked), where CPython takes 73× (2026-11-14, Linux x86_64, python -m benchmarks.wholeprog and --unchecked, Python 3.14).
The argument lives in the figures: every postpile figure is computed byte-identically to CPython's answer, re-proven by the differential suite on every build. TurboPython, which led on two kernels in August, computes different answers on every one (checksums 1.4% off CPython's), and part of Numba's edge is the same bit-changing currency; postpile refuses it, at a measured cost in the single-digit percent.
In six slides¶
Open the slides full screen, or download them as a PDF.
Where to go next¶
- Getting started: write a POST kernel, build it, and call it.
- User guide: Installation · CLI reference · the POST Python language · Distribution.
- Developer guide: Architecture · IR reference · the backend protocol and writing a backend · Testing · Benchmarking.
- The design record: the ADR index, fifty-three decisions with their supersession graph, cross-referenced with the arbitration register.