This document discusses PyPy, an alternative implementation of the Python language that aims to be faster than CPython while maintaining compatibility. It covers how to install PyPy, notes on garbage collection and C extensions, techniques for optimizing code for PyPy like focusing on static types, and the status of Python 3 support in PyPy.
7. INSTALLATION OPTIONS
From the package manager
On Ubuntu, use the PPA: ppa:pypy/ppa
Official binaries from
Portable PyPy (Linux only):
pyenv:
http://pypy.org/download.html
https://github.com/squeaky-
pl/portable-pypy
https://github.com/yyuu/pyenv
18. OPTIMISING FOR PYPY
Aim for mostly-static types
Function calls are ~free
Instance maps
List strategies
Dicts are slow
19. BENCHMARKING
Measure, don’t guess!
Your tests are not a good benchmark
“WARNING: timeit is a very unreliable tool. use perf or
something else for real measurements”
26. CFFI
Design principle: users only need to know C and Python
Bundled with PyPy
Performance: OK on CPython, fast on PyPy
Docs: http://cffi.readthedocs.org