PyPy

Anton Blomberg

anton@deadlock.se

What is PyPy and why should I use it?

What

Fast Python interpreter

Built in Python

Why

Fast
Drop-in replacement
Library compatible
Easy to install

Why

Fast
Drop-in replacement
Library compatible
Easy to install

PyPy vs CPython

PyPy is not getting slower

Why

Fast
Drop-in replacement
Library compatible
Easy to install

def hello(name):
    print("Hello {}!".format(name))

if __name__ == '__main__':
    hello("Anton")

CPython

def hello(name):
    print("Hello {}!".format(name))

if __name__ == '__main__':
    hello("Anton")

PyPy

Why

Fast
Drop-in replacement

Library compatible
Easy to install

Django

Flask

Bottle

Pylons

Pyramid

Twisted

lxml

Beautiful Soup

Sphinx

IPyton
PIL/Pillow

Psycopg2

MySQL-Python

pysqlite

pymongo

cx_Oracle

SQLAlchemy

Gunicorn

Requests

nose

pytest

celery

pip

Numpy

Scipy

Gevent

Why

Fast
Drop-in replacement
Library compatible

Easy to install

Installing

# Ubuntu
sudo apt-get install pypy

# Mac
sudo brew install pypy

# Windows
# Why would you even?

Latest version x86/-64 and ARM binary archive downloads available for all platforms

How

Just-in-time compiler (JIT)
No reference counting
Native list types
Built in Python

How

Just-in-time compiler (JIT)
No reference counting
Native list types
Built in Python

JIT

Ahead of time vs Just in time

           Static vs Dynamic

     Method vs Tracing

JIT

  1. Intepret program as usual

  2. Detect hot loops

  3. Trace

  4. Compile

  5. Execute

How

Just-in-time compiler (JIT)
No reference counting
Native list types
Built in Python

How

Just-in-time compiler (JIT)
No reference counting
Native list types
Built in Python

How

Just-in-time compiler (JIT)
No reference counting
Native list types
Built in Python

Who

Science project from 2002 by Armin Rigo

Funded by EU, PSF, Google, donations


2007: 1.0 released
2011:   CPython compatible
2013:  Python3

Challenges

C-Extensions

Killing the GIL

More languages

Questions?

 

 

 

 

 

Anton Blomberg

anton@deadlock.se

Thanks!

 

 

(please donate to PyPy!)

 

 

Anton Blomberg

anton@deadlock.se

Made with Slides.com