Clear, practical technology insights BSOD Code Lookup · Windows Error Code Lookup · Wi-Fi Troubleshooting · PC Troubleshooting Checklist

What Is PyPy? When the Alternative Python Runtime Can Be Faster

Learn when PyPy’s JIT helps, install it alongside CPython, and compare compatibility, startup time, throughput, and memory on a real workload.

Table of Contents

PyPy is an alternative implementation of Python. Its just-in-time (JIT) compiler can speed up frequently executed Python code while a program runs. It is worth testing for a long-running, CPU-bound program that spends much of its time in Python. Short commands, I/O-bound jobs, and workloads dominated by native libraries can behave differently.

PyPy Series - Part 1: Introduction to PyPy Picture 1

How PyPy differs from CPython

PyPy implements a version of the Python language, and CPython is the implementation distributed by Python.org. PyPy’s JIT identifies frequently executed paths and compiles them while the program runs. That takes time to warm up. PyPy supports many packages, but some compiled extensions require a compatible build, and extensions written for CPython may behave or perform differently. See PyPy’s compatibility notes.

PyPy Series - Part 1: Introduction to PyPy Picture 3

PyPy project website. Image credit: PyPy.

Try PyPy without replacing your Python installation

  1. Download a stable build for your operating system and architecture from the official PyPy downloads. Check which Python language version the build supports.
  2. Extract it and run the executable in the archive. On a shell where the executable is named pypy3 and is on your path, run pypy3 --version.
  3. Use a separate environment for your project’s dependencies. Install the packages and run the same tests under PyPy and CPython before timing either. Follow the PyPy installation guide for platform and packaging options.

Benchmark the workload you actually run

Use the same input and dependency versions under both interpreters. For a short CLI command, measure total runtime from process start. For a persistent worker, also measure throughput after warm-up. Confirm both produce the same result and compare memory use when it matters. A tight loop can reveal a JIT effect, but it does not predict the speed of an application waiting on storage or a network.

Historical benchmark screenshots
PyPy Series - Part 1: Introduction to PyPy Picture 2
Historical comparison from the Computer Language Benchmarks Game.
PyPy Series - Part 1: Introduction to PyPy Picture 4
Original microbenchmark output. Results are specific to the interpreter versions, machine, and test.

If you are new to the language and its tooling, start with the Python fundamentals course.

Discussion

Reader Comments 0

Sign in with email or Google to join the discussion.