PyPy is a fast runtime for Python.
It can speed up execution time up to 7x compared to normal CPython for sequential tasks.
Using a Just-In-Time compiler it has a similar approach as HHVM for PHP and Rubinius for Ruby.
This talks gives an overview of the current project goals, namely improving parallel execution speed with PyPy STM and improving C-Extension compatibility.
4. Why PyPy?
No more support for older versions
Major bugfixes
New language features
Improved performance
Incentives to switch to a new language version
12. Why PyPy?
0
38
75
113
150
2007 2009 2011 2013 2015
PHP Python Ruby
baseline (100%)
speed (%)
time
Relative performance improvements per language over time
13. Why PyPy?
The net result of the 3.0 generalizations is that
Python 3.0 runs the pystone benchmark around 10% slower than Python 2.5.
Most likely the biggest cause is the removal of special-casing for small
integers. There’s room for improvement, but it will happen after 3.0 is
released!
docs.python.org/3/whatsnew/3.0.html
14. Why PyPy?
Two ways to speed up a scripting language
•Improve the implementation
•Improve the runtime
16. About PyPy
Cottrell & Babcock's air spring printing press
Source: Scientific American, June 22, 1872
17. What is PyPy?
Followup of Psyco runtime
Version 1.0 in 2007
Python written in Python
Just-In-Time compiler
Compatible with Python 2.7 and 3.4
18. What is PyPy?
Followup of Psyco runtime
Version 1.0 in 2007
Python written in Python RPython
Just-In-Time compiler
Compatible with Python 2.7 and 3.4
19. PyPy implementation
• Variables in any given control flow path must have only a single type
• No multiple inheritance
• No generators
• Most dunder-methods can't be used.
RPython is a subset of Python
http://www.quora.com/PyPy/How-annoying-is-writing-RPython-compared-to-Python
26. The future of PyPy
Berryman's steam trap, 1872
Source: Scientific American, Sept 14,1872
27. Project milestones
2008 Django support
2010 First JIT-compiler
2011 Compatibility with CPython 2.7
2014 Basic ARM support
CPython 3 support
Improve compatibility with C extensions
NumPyPy
Multi-threading support
28. Project milestones
2008 Django support
2010 First JIT-compiler
2011 Compatibility with CPython 2.7
2014 Basic ARM support
CPython 3 support
Improve compatibility with C extensions
NumPyPy
Multi-threading support
31. PyPy STM
10 loops, best of 3: 1.2 sec per loop10 loops, best of 3: 822 msec per loop
from threading import Thread
def count(n):
while n > 0:
n -= 1
def run():
t1 = Thread(target=count, args=(10000000,))
t1.start()
t2 = Thread(target=count, args=(10000000,))
t2.start()
t1.join(); t2.join()
def count(n):
while n > 0:
n -= 1
def run():
count(10000000)
count(10000000)
Inside the Python GIL - David Beazley
42. Blueprints provided by Marcel Douwe Dekker under Creative Commons.
https://www.flickr.com/photos/marceldouwedekker/7564782310/in/
photostream/
Blueprint by Joy Oil Co Ltd (http://commons.wikimedia.org/wiki/
File:Joy_Oil_gas_station_blueprints.jpg)
Credits
43. by Simon Child
and by Luis Prado
by Océan Bussard
by Luis Rodrigues
by Mister Pixel
by Alexander Wiefel
by Darin S
by spotted paint
The icons used in this presentation were downloaded from The Noun Project.
Thanks to the following artists: