SlideShare a Scribd company logo
1 of 27
the sequel
Mark Rees
CTO
Century Software (M) Sdn Bhd
is it ready for production?
pypy & me
not affiliated with pypy team
have followed it‟s development since
2004
use cpython and jython at work
used ironpython for small projects
gave a similar talk at PyConAU 2012
the question:
would pypy improve performance of
some of our workloads?
i am a manager, who still is wants to be a
programmer, so i did the analysis
pypy
history
- first sprint 2003, EU project from 2004 – 2007
- open source project from 2007
https://bitbucket.org/pypy
- pypy 1.4 first release suitable for “production”
12/2010
what is pypy?
- RPython translation toolchain, a framework for
generating dynamic programming language
implementations
- a implementation of Python in Python using the
framework
pypy
current release
pypy 2.0 released may 2013
latest iteration 2.0.2
want to know more about pypy
- http://pypy.org/
- david beazley pycon 2012 keynote
http://goo.gl/5PXFQ
- how the pypy jit works http://goo.gl/dKgFp
- why pypy by example http://goo.gl/vpQyJ
production ready – a definition
it runs
it satisfies the project requirements
its design was well thought out
it's stable
it's maintainable
it's scalable
it's documented
it works with the python modules we use
it is as fast or faster than cpython
http://programmers.stackexchange.com/questions/61726/define-production-ready
pypy – does it run?
of course, it runs
See http://pypy.readthedocs.org/en/latest/cpython_differences.html
for differences between PyPy and CPython
pypy – other production criteria
does it satisfy the project requirements
- yes
is it‟s design was well thought out
- I would assume so
is it stable
- yes
is it maintainable
- 7 out of 10
is it scalable
- stackless & greenlets built in
is it documented
- cpython docs for functionality, rpython toolchain 8 out
of 10
pypy – does it work with the modules we use
standard library modules supported:
__builtin__, __pypy__, _ast, _bisect, _codecs, _collections, _ffi, _hashlib,
_io, _locale, _lsprof, _md5, _minimal_curses, _multiprocessing, _random,
_rawffi, _sha, _socket, _sre, _ssl, _warnings, _weakref, _winreg, array,
binascii, bz2, cStringIO, clr, cmath, cpyext, crypt, errno, exceptions,
fcntl, gc, imp, itertools, marshal, math, mmap, operator, oracle, parser,
posix, pyexpat, select, signal, struct, symbol, sys, termios, thread, time,
token, unicodedata, zipimport, zlib
these modules are supported but written in
python:
cPickle, _csv, ctypes, datetime, dbm, _functools, grp, pwd, readline,
resource, sqlite3, syslog, tputil
many python libs are known to work, like:
ctypes, django, pyglet, sqlalchemy, PIL. See
https://bitbucket.org/pypy/compatibility/wiki/Home for a more
exhaustive list.
pypy – does it work with the modules we use
pypy c-api support is beta, worked most of
the time but failed with reportlab:
Fatal error in cpyext, CPython compatibility layer, calling
PySequence_GetItem
Either report a bug or consider not using this particular extension
<OpErrFmt object at 0x7f94582f3100>
RPython traceback:
File ”pypy_module_cpyext_api_1.c", line 30287, in PySequence_GetItem
File ”pypy_module_cpyext_pyobject.c", line 1056, in
BaseCpyTypedescr_realize
File ”pypy_objspace_std_objspace.c", line 3404, in
allocate_instance__W_ObjectObject
File ”pypy_objspace_std_typeobject.c", line 33781, in
W_TypeObject_check_user_subclass
Segmentation fault
But this was the only compatibility issue we
had running all of our python code under
pypy and we could fallback to pure python
reportlab extensions anyway.
pypy – does it work with the modules you use
Ipython notebook requires tornado & zeromq
pypy – does it work with the modules you use
pypy – does it run as fast as cpython
http://speed.pypy.org/
but!
pypy django benchmark
DJANGO_TMPL = Template("""<table>
{% for row in table %}
<tr>{% for col in row %}<td>{{ col|escape }}</td>{% endfor %}</tr>
{% endfor %}
</table>
""")
def test_django(count):
table = [xrange(150) for _ in xrange(150)]
context = Context({"table": table})
# Warm up Django.
DJANGO_TMPL.render(context)
DJANGO_TMPL.render(context)
times = []
for _ in xrange(count):
t0 = time.time()
data = DJANGO_TMPL.render(context)
t1 = time.time()
times.append(t1 - t0)
return times
my csv to xml benchmark
def bench(data, output):
f = open(data, 'rb')
fn = [„age‟,….]
reader = csv.DictReader(f, fn)
writer = SAXWriter(output)
writer.start_doc()
writer.start_tag('data')
try:
for row in reader:
writer.start_tag('row')
for key in row.keys():
writer.tag(key.replace(' ', '_'), body=row[key])
writer.end_tag('row')
finally:
f.close()
writer.end_tag('data')
writer.end_doc()
my pypy benchmarks
https://bitbucket.org/hexdump42/pypy-benchmarks
benchmark cpython
2.7.3
pypy-jit
1.9
pypy-jit
2.0.2
bm_csv2xml 88.26/94.
04
28.89 3.0549 x
faster
23.86 3.7728x
faster
average execution time (in seconds)
my pypy benchmarks
https://bitbucket.org/hexdump42/pypy-benchmarks
benchmark cpython
2.7.3
pypy-jit
1.9
pypy-jit
2.0.2
bm_csv2xml 88.26/94.
04
28.89 3.0549 x
faster
23.86 3.7728x
faster
bm_csv 1.54/1.65 5.89 3.8122 x
slower
1.72 0.9825 x
slower
average execution time (in seconds)
my pypy benchmarks
https://bitbucket.org/hexdump42/pypy-benchmarks
benchmark cpython
2.7.3
pypy-jit
1.9
pypy-jit
2.0.2
bm_csv2xml 88.26/94.
04
28.89 3.0549 x
faster
23.86 3.7728x
faster
bm_csv 1.54/1.65 5.89 3.8122 x
slower
1.72 0.9825 x
slower
bm_openpyxl 1.31/1.21 3.26 2.4871 x
slower
3.15 2.6051 x
slower
average execution time (in seconds)
my pypy benchmarks
https://bitbucket.org/hexdump42/pypy-benchmarks
benchmark cpython
2.7.3
pypy-jit
1.9
pypy-jit
2.0.2
bm_csv2xml 88.26/94.
04
28.89 3.0549 x
faster
23.86 3.7728x
faster
bm_csv 1.54/1.65 5.89 3.8122 x
slower
1.72 0.9825 x
slower
bm_openpyxml 1.31/1.21 3.26 2.4871 x
slower
3.15 2.6051 x
slower
bm_xhtml2pdf 1.91/1.95 3.27 1.7155 x
slower
4.22 2.1637 x
slower
average execution time (in seconds)
my pypy benchmarks
https://bitbucket.org/hexdump42/pypy-benchmarks
benchmark cpython
2.7.3
pypy-jit
1.9
pypy-jit
2.0.2
bm_interp 5412/5248 12556 2.32 x
larger
21880 4.1692 x
larger
bm_csv2xml 7048/7064 55180 7.8292 x
larger
55232 7.8188 x
larger
bm_csv 5812/5180 52200 8.9814 x
larger
52176 10.0726
x larger
bm_openpyxl 12656/
12656
77252 6.1040 x
larger
80428 6.3549 x
larger
bm_xhtml2pdf 48880/
34884
236792 4.8444 x
larger
101376 2.906 x
larger
max memory use
what is the pypy jit doing?
https://bitbucket.org/pypy/jitviewer/
modified csv pypy benchmarks
https://bitbucket.org/hexdump42/pypy-benchmarks
benchmark cpython
2.7.3
pypy-jit
1.9
pypy-jit
2.0.2
bm_csv2xml_mod 88.25/90.02 23.65 3.7315 x
faster
21.76 4.0556 x
faster
bm_csv_mod 1.62/1.69 1.89 0.8571 x
slower
1.68 0.9643 x
slower
average execution time (in seconds)
is pypy ready for production
1. it runs
2. it satisfies the project requirements
3. its design was well thought out
4. it's stable
5. it's maintainable
6. it's scalable
7. it's documented
8. it works with the python modules we use
9. it can be as fast or faster than cpython
some other reasons to consider pypy
cffi – C foreign function interface for python
- http://cffi.readthedocs.org/
pypy version of numpy
py3k version of pypy work-in-progress
check out the STM/AME project
-
https://speakerdeck.com/pyconslides/pypy-
python-without-the-gil-by-armin-rigo-and-
maciej-fijalkowski
You can help
http://www.pypy.org/howtohelp.html
now for something different
cffi better than ctypes?
cffi better than ctypes?
Mark Rees
mark at censof dot com
+Mark Rees
@hexdump42
hex-dump.blogspot.com
contact details
http://www.slideshare.net/hexdump42/pypy-isitreadyforproductionthesequel
http://goo.gl/8IPuX

More Related Content

What's hot

Multiprocessing with python
Multiprocessing with pythonMultiprocessing with python
Multiprocessing with pythonPatrick Vergain
 
Python Developer Certification
Python Developer CertificationPython Developer Certification
Python Developer CertificationVskills
 
CHEP 2018: A Python upgrade to the GooFit package for parallel fitting
CHEP 2018: A Python upgrade to the GooFit package for parallel fittingCHEP 2018: A Python upgrade to the GooFit package for parallel fitting
CHEP 2018: A Python upgrade to the GooFit package for parallel fittingHenry Schreiner
 
Learning Python from Data
Learning Python from DataLearning Python from Data
Learning Python from DataMosky Liu
 
Practicing Python 3
Practicing Python 3Practicing Python 3
Practicing Python 3Mosky Liu
 
Automatically Fusing Functions on CuPy
Automatically Fusing Functions on CuPyAutomatically Fusing Functions on CuPy
Automatically Fusing Functions on CuPyPreferred Networks
 
CHEP 2019: Recent developments in histogram libraries
CHEP 2019: Recent developments in histogram librariesCHEP 2019: Recent developments in histogram libraries
CHEP 2019: Recent developments in histogram librariesHenry Schreiner
 
2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and histHenry Schreiner
 
Parallel programming using python
Parallel programming using python Parallel programming using python
Parallel programming using python Samah Gad
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Younggun Kim
 
Introduction to Polyaxon
Introduction to PolyaxonIntroduction to Polyaxon
Introduction to PolyaxonYu Ishikawa
 
Concurrency in Python
Concurrency in PythonConcurrency in Python
Concurrency in PythonGavin Roy
 

What's hot (19)

CuPy v4 and v5 roadmap
CuPy v4 and v5 roadmapCuPy v4 and v5 roadmap
CuPy v4 and v5 roadmap
 
Move from C to Go
Move from C to GoMove from C to Go
Move from C to Go
 
Multiprocessing with python
Multiprocessing with pythonMultiprocessing with python
Multiprocessing with python
 
Python Developer Certification
Python Developer CertificationPython Developer Certification
Python Developer Certification
 
CHEP 2018: A Python upgrade to the GooFit package for parallel fitting
CHEP 2018: A Python upgrade to the GooFit package for parallel fittingCHEP 2018: A Python upgrade to the GooFit package for parallel fitting
CHEP 2018: A Python upgrade to the GooFit package for parallel fitting
 
Learning Python from Data
Learning Python from DataLearning Python from Data
Learning Python from Data
 
Practicing Python 3
Practicing Python 3Practicing Python 3
Practicing Python 3
 
Automatically Fusing Functions on CuPy
Automatically Fusing Functions on CuPyAutomatically Fusing Functions on CuPy
Automatically Fusing Functions on CuPy
 
CHEP 2019: Recent developments in histogram libraries
CHEP 2019: Recent developments in histogram librariesCHEP 2019: Recent developments in histogram libraries
CHEP 2019: Recent developments in histogram libraries
 
2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist2019 IRIS-HEP AS workshop: Boost-histogram and hist
2019 IRIS-HEP AS workshop: Boost-histogram and hist
 
Presentation1
Presentation1Presentation1
Presentation1
 
Raspberry pi a la cfml
Raspberry pi a la cfmlRaspberry pi a la cfml
Raspberry pi a la cfml
 
Parallel programming using python
Parallel programming using python Parallel programming using python
Parallel programming using python
 
Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015Writing Fast Code (JP) - PyCon JP 2015
Writing Fast Code (JP) - PyCon JP 2015
 
Introduction to Polyaxon
Introduction to PolyaxonIntroduction to Polyaxon
Introduction to Polyaxon
 
Concurrency in Python
Concurrency in PythonConcurrency in Python
Concurrency in Python
 
Chainer v4 and v5
Chainer v4 and v5Chainer v4 and v5
Chainer v4 and v5
 
Day4
Day4Day4
Day4
 
Available HPC resources at CSUC
Available HPC resources at CSUCAvailable HPC resources at CSUC
Available HPC resources at CSUC
 

Similar to Is PyPy Ready for Production? The Sequel

Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance PythonIan Ozsvald
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIYoni Davidson
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MoreMatt Harrison
 
Debugging Python with gdb
Debugging Python with gdbDebugging Python with gdb
Debugging Python with gdbRoman Podoliaka
 
Debugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDBDebugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDBbmbouter
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk PemulaOon Arfiandwi
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingHenry Schreiner
 
나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스효준 강
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsHenry Schreiner
 
Performance Enhancement Tips
Performance Enhancement TipsPerformance Enhancement Tips
Performance Enhancement TipsTim (文昌)
 
First python project
First python projectFirst python project
First python projectNeetu Jain
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Henry Schreiner
 
PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat
PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat
PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat Pôle Systematic Paris-Region
 
Swift profiling middleware and tools
Swift profiling middleware and toolsSwift profiling middleware and tools
Swift profiling middleware and toolszhang hua
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performancesource{d}
 
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...Piotr Przymus
 
GDG-MLOps using Protobuf in Unity
GDG-MLOps using Protobuf in UnityGDG-MLOps using Protobuf in Unity
GDG-MLOps using Protobuf in UnityIvan Chiou
 
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo OmuraPreferred Networks
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python ProgrammingDozie Agbo
 

Similar to Is PyPy Ready for Production? The Sequel (20)

Euro python2011 High Performance Python
Euro python2011 High Performance PythonEuro python2011 High Performance Python
Euro python2011 High Performance Python
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-API
 
PyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and MorePyCon 2013 : Scripting to PyPi to GitHub and More
PyCon 2013 : Scripting to PyPi to GitHub and More
 
Python Orientation
Python OrientationPython Orientation
Python Orientation
 
Debugging Python with gdb
Debugging Python with gdbDebugging Python with gdb
Debugging Python with gdb
 
Debugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDBDebugging Hung Python Processes With GDB
Debugging Hung Python Processes With GDB
 
Pemrograman Python untuk Pemula
Pemrograman Python untuk PemulaPemrograman Python untuk Pemula
Pemrograman Python untuk Pemula
 
Princeton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance ToolingPrinceton Wintersession: Software Quality Assurance Tooling
Princeton Wintersession: Software Quality Assurance Tooling
 
나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스나도 할 수 있다 오픈소스
나도 할 수 있다 오픈소스
 
PyCon2022 - Building Python Extensions
PyCon2022 - Building Python ExtensionsPyCon2022 - Building Python Extensions
PyCon2022 - Building Python Extensions
 
Performance Enhancement Tips
Performance Enhancement TipsPerformance Enhancement Tips
Performance Enhancement Tips
 
First python project
First python projectFirst python project
First python project
 
Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023Software Quality Assurance Tooling 2023
Software Quality Assurance Tooling 2023
 
PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat
PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat
PyParis 2017 / Writing a C Python extension in 2017, Jean-Baptiste Aviat
 
Swift profiling middleware and tools
Swift profiling middleware and toolsSwift profiling middleware and tools
Swift profiling middleware and tools
 
Improving go-git performance
Improving go-git performanceImproving go-git performance
Improving go-git performance
 
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
Everything You Always Wanted to Know About Memory in Python - But Were Afraid...
 
GDG-MLOps using Protobuf in Unity
GDG-MLOps using Protobuf in UnityGDG-MLOps using Protobuf in Unity
GDG-MLOps using Protobuf in Unity
 
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
20180926 kubeflow-meetup-1-kubeflow-operators-Preferred Networks-Shingo Omura
 
First Steps in Python Programming
First Steps in Python ProgrammingFirst Steps in Python Programming
First Steps in Python Programming
 

More from Mark Rees

Porting a legacy app to python 3
Porting a legacy app to python 3Porting a legacy app to python 3
Porting a legacy app to python 3Mark Rees
 
Relational Database Access with Python
Relational Database Access with PythonRelational Database Access with Python
Relational Database Access with PythonMark Rees
 
Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014Mark Rees
 
Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014Mark Rees
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM Mark Rees
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.Mark Rees
 

More from Mark Rees (6)

Porting a legacy app to python 3
Porting a legacy app to python 3Porting a legacy app to python 3
Porting a legacy app to python 3
 
Relational Database Access with Python
Relational Database Access with PythonRelational Database Access with Python
Relational Database Access with Python
 
Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014Seeing with Python presented at PyCon AU 2014
Seeing with Python presented at PyCon AU 2014
 
Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014Seeing with Python - Pycon SG 2014
Seeing with Python - Pycon SG 2014
 
Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM  Relational Database Access with Python ‘sans’ ORM
Relational Database Access with Python ‘sans’ ORM
 
What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.What do you mean it needs to be Java based? How jython saved the day.
What do you mean it needs to be Java based? How jython saved the day.
 

Recently uploaded

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Recently uploaded (20)

Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

Is PyPy Ready for Production? The Sequel

  • 1. the sequel Mark Rees CTO Century Software (M) Sdn Bhd is it ready for production?
  • 2. pypy & me not affiliated with pypy team have followed it‟s development since 2004 use cpython and jython at work used ironpython for small projects gave a similar talk at PyConAU 2012 the question: would pypy improve performance of some of our workloads? i am a manager, who still is wants to be a programmer, so i did the analysis
  • 3. pypy history - first sprint 2003, EU project from 2004 – 2007 - open source project from 2007 https://bitbucket.org/pypy - pypy 1.4 first release suitable for “production” 12/2010 what is pypy? - RPython translation toolchain, a framework for generating dynamic programming language implementations - a implementation of Python in Python using the framework
  • 4. pypy current release pypy 2.0 released may 2013 latest iteration 2.0.2 want to know more about pypy - http://pypy.org/ - david beazley pycon 2012 keynote http://goo.gl/5PXFQ - how the pypy jit works http://goo.gl/dKgFp - why pypy by example http://goo.gl/vpQyJ
  • 5. production ready – a definition it runs it satisfies the project requirements its design was well thought out it's stable it's maintainable it's scalable it's documented it works with the python modules we use it is as fast or faster than cpython http://programmers.stackexchange.com/questions/61726/define-production-ready
  • 6. pypy – does it run? of course, it runs See http://pypy.readthedocs.org/en/latest/cpython_differences.html for differences between PyPy and CPython
  • 7. pypy – other production criteria does it satisfy the project requirements - yes is it‟s design was well thought out - I would assume so is it stable - yes is it maintainable - 7 out of 10 is it scalable - stackless & greenlets built in is it documented - cpython docs for functionality, rpython toolchain 8 out of 10
  • 8. pypy – does it work with the modules we use standard library modules supported: __builtin__, __pypy__, _ast, _bisect, _codecs, _collections, _ffi, _hashlib, _io, _locale, _lsprof, _md5, _minimal_curses, _multiprocessing, _random, _rawffi, _sha, _socket, _sre, _ssl, _warnings, _weakref, _winreg, array, binascii, bz2, cStringIO, clr, cmath, cpyext, crypt, errno, exceptions, fcntl, gc, imp, itertools, marshal, math, mmap, operator, oracle, parser, posix, pyexpat, select, signal, struct, symbol, sys, termios, thread, time, token, unicodedata, zipimport, zlib these modules are supported but written in python: cPickle, _csv, ctypes, datetime, dbm, _functools, grp, pwd, readline, resource, sqlite3, syslog, tputil many python libs are known to work, like: ctypes, django, pyglet, sqlalchemy, PIL. See https://bitbucket.org/pypy/compatibility/wiki/Home for a more exhaustive list.
  • 9. pypy – does it work with the modules we use pypy c-api support is beta, worked most of the time but failed with reportlab: Fatal error in cpyext, CPython compatibility layer, calling PySequence_GetItem Either report a bug or consider not using this particular extension <OpErrFmt object at 0x7f94582f3100> RPython traceback: File ”pypy_module_cpyext_api_1.c", line 30287, in PySequence_GetItem File ”pypy_module_cpyext_pyobject.c", line 1056, in BaseCpyTypedescr_realize File ”pypy_objspace_std_objspace.c", line 3404, in allocate_instance__W_ObjectObject File ”pypy_objspace_std_typeobject.c", line 33781, in W_TypeObject_check_user_subclass Segmentation fault But this was the only compatibility issue we had running all of our python code under pypy and we could fallback to pure python reportlab extensions anyway.
  • 10. pypy – does it work with the modules you use Ipython notebook requires tornado & zeromq
  • 11. pypy – does it work with the modules you use
  • 12. pypy – does it run as fast as cpython http://speed.pypy.org/ but!
  • 13. pypy django benchmark DJANGO_TMPL = Template("""<table> {% for row in table %} <tr>{% for col in row %}<td>{{ col|escape }}</td>{% endfor %}</tr> {% endfor %} </table> """) def test_django(count): table = [xrange(150) for _ in xrange(150)] context = Context({"table": table}) # Warm up Django. DJANGO_TMPL.render(context) DJANGO_TMPL.render(context) times = [] for _ in xrange(count): t0 = time.time() data = DJANGO_TMPL.render(context) t1 = time.time() times.append(t1 - t0) return times
  • 14. my csv to xml benchmark def bench(data, output): f = open(data, 'rb') fn = [„age‟,….] reader = csv.DictReader(f, fn) writer = SAXWriter(output) writer.start_doc() writer.start_tag('data') try: for row in reader: writer.start_tag('row') for key in row.keys(): writer.tag(key.replace(' ', '_'), body=row[key]) writer.end_tag('row') finally: f.close() writer.end_tag('data') writer.end_doc()
  • 15. my pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks benchmark cpython 2.7.3 pypy-jit 1.9 pypy-jit 2.0.2 bm_csv2xml 88.26/94. 04 28.89 3.0549 x faster 23.86 3.7728x faster average execution time (in seconds)
  • 16. my pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks benchmark cpython 2.7.3 pypy-jit 1.9 pypy-jit 2.0.2 bm_csv2xml 88.26/94. 04 28.89 3.0549 x faster 23.86 3.7728x faster bm_csv 1.54/1.65 5.89 3.8122 x slower 1.72 0.9825 x slower average execution time (in seconds)
  • 17. my pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks benchmark cpython 2.7.3 pypy-jit 1.9 pypy-jit 2.0.2 bm_csv2xml 88.26/94. 04 28.89 3.0549 x faster 23.86 3.7728x faster bm_csv 1.54/1.65 5.89 3.8122 x slower 1.72 0.9825 x slower bm_openpyxl 1.31/1.21 3.26 2.4871 x slower 3.15 2.6051 x slower average execution time (in seconds)
  • 18. my pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks benchmark cpython 2.7.3 pypy-jit 1.9 pypy-jit 2.0.2 bm_csv2xml 88.26/94. 04 28.89 3.0549 x faster 23.86 3.7728x faster bm_csv 1.54/1.65 5.89 3.8122 x slower 1.72 0.9825 x slower bm_openpyxml 1.31/1.21 3.26 2.4871 x slower 3.15 2.6051 x slower bm_xhtml2pdf 1.91/1.95 3.27 1.7155 x slower 4.22 2.1637 x slower average execution time (in seconds)
  • 19. my pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks benchmark cpython 2.7.3 pypy-jit 1.9 pypy-jit 2.0.2 bm_interp 5412/5248 12556 2.32 x larger 21880 4.1692 x larger bm_csv2xml 7048/7064 55180 7.8292 x larger 55232 7.8188 x larger bm_csv 5812/5180 52200 8.9814 x larger 52176 10.0726 x larger bm_openpyxl 12656/ 12656 77252 6.1040 x larger 80428 6.3549 x larger bm_xhtml2pdf 48880/ 34884 236792 4.8444 x larger 101376 2.906 x larger max memory use
  • 20. what is the pypy jit doing? https://bitbucket.org/pypy/jitviewer/
  • 21. modified csv pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks benchmark cpython 2.7.3 pypy-jit 1.9 pypy-jit 2.0.2 bm_csv2xml_mod 88.25/90.02 23.65 3.7315 x faster 21.76 4.0556 x faster bm_csv_mod 1.62/1.69 1.89 0.8571 x slower 1.68 0.9643 x slower average execution time (in seconds)
  • 22. is pypy ready for production 1. it runs 2. it satisfies the project requirements 3. its design was well thought out 4. it's stable 5. it's maintainable 6. it's scalable 7. it's documented 8. it works with the python modules we use 9. it can be as fast or faster than cpython
  • 23. some other reasons to consider pypy cffi – C foreign function interface for python - http://cffi.readthedocs.org/ pypy version of numpy py3k version of pypy work-in-progress check out the STM/AME project - https://speakerdeck.com/pyconslides/pypy- python-without-the-gil-by-armin-rigo-and- maciej-fijalkowski You can help http://www.pypy.org/howtohelp.html
  • 24. now for something different
  • 25. cffi better than ctypes?
  • 26. cffi better than ctypes?
  • 27. Mark Rees mark at censof dot com +Mark Rees @hexdump42 hex-dump.blogspot.com contact details http://www.slideshare.net/hexdump42/pypy-isitreadyforproductionthesequel http://goo.gl/8IPuX

Editor's Notes

  1. I have listed a number of resources that I found helpful but this talk is more about using pypy rather than how it works.
  2. The first 8 criteria came from a question on stackexchange, the last 2 are my additional requirements. A little detailed definition than the management version: it runs, it makes money. You may disagree with the list but it’s the criteria I will be using. Also I will be biased towards the needs of the company I work for. So let’s work thru the list to see how pypy stacks up.
  3. It runs great on x86 32bit and 64bit platforms under Linux, Windows and OS X. There are other backend implementations – ARM, PPC, Java &amp; .NET VM’s. Some have had more love than others. Pypy implements the Python language version 2.7.3, supporting all of the core language passing the Python test suite. It supports most of the standard library modules. It has support for CPython C API but it is beta quality. I will go into more detail about standard library and other module compatibility later in the talk.
  4. I am not a language interpreter designer so I cannot really comment on the design but you would assume with the number of years development &amp; refactoring by the pypy team it is a well thought out design.With regards maintainability, due to much of the pypytoolchain using RPython and the complexity of the architecture I feel it is hard for the normal python programmer to be able to contribute to coding maintenance of pypy. The learning curve is steep but certainly maintainability f the pure-python portions of the pypy components are easier.
  5. As I said before pypy implements python language version 2.7.2
  6. As at pypy 2.0.2 c-api support is considered beta and while it worked for many of the modules we use e.g PIL, it failed with the c extensions for reportlab. This wasn’t a show-stopper as these extensions also have python equivalents in the standard reportlab distribution. Of course, our python library use will be different from yours, so you experience will be different as well.
  7. Since Wes used ipython notebook in his keynote this morning, I thought I should see if it would work under pypy. Apart from a unicode to char issue with zeromqsocket.py that was simply patched it worked great. Panda’s was a bigger challenge.
  8. pypy has work in progress implementation of numpy written in pypy. It is called numpypy.
  9. The above plot represents PyPy trunk (with JIT) benchmark times normalized to Cpython as at 12 June 2013. Smaller is better.The standard benchmarks are limited to one domain and do not in a lot of cases cover complete processes or workloads. For example:
  10. Thedjango benchmark in the standard pypy benchmark suite and was originally part of the unladen swallow benchmarks. So this benchmark is only testing the template rendering performance of django. There is nothing wrong with this and it’s a standard benchmark technique. So if you see the results of this benchmark, then it’s likely the performance of django template rendering under pypy would be faster than cpython. Does this mean your django website perfromance would be better? Maybe or maybe not.
  11. My benchmarks are a little different from the standard pypy as they simulate workloads similar to what we use python for at work. So rather than benchmarking a small portion or function as the standard benchmarks do, mine cover either a complete process or the majority of one. So my benchmarks are impacted by io as well as the in-program execution. Since the majority of the non web use of in our workplace is extract/transform/load (ETL) tasks, this is what the benchmarks are doing.
  12. To perform the benchmarks, a clone of the pypy benchmark tools was done and my benchmarks added to it. You can see these at https://bitbucket.org/hexdump42/pypy-benchmarks. The benchmarks were run on a VMWare virtual instance with 2GB RAM, 1 Core 64bit running Scientific Linux 6.2. The base CPython used was 2.7.2 and comparison benchmarks were run against pypy-jit release 1.9 and the nightly pypy-jit build of August 14 2012 collecting avg execution time and memory use. 50 iteration benchmark runs. So for the bm_csv2xml benchmark, 100Mb csv file of census data to loaded, parsed and output as xml to a file. So it is faster than cpython, things are looking good. But I had hoped it would be a little better. So
  13. I created a benchmark of just the csv load and parse and was surprised for pypy 1.9 to see that it was slower than the cpython equivalent, so in my previous benchmark the xml output was what gave the improved performance under pypy. Note that in 2.0.2 csv conversion is now on-par. This indicates there has been an improvement in the JIT.
  14. .
  15. The bm_interp benchmark just provides a baseline of what memory just the interpreter uses prior to any real work.Just in case these benchmark results were related to something related to my vm configuration, I also reran these benchmarks on physical hardware and obtained similar results. If I had stopped here, you would have say that pypy didn’t meet my production criteria but since some of the components that affect the performance are in python under pypy, I decided to see why performance wasn’t the same or better than cpython. I decided to start with the low hanging fruit – csv performance.
  16. You can use the pypyjit viewer to see what is happening and of course I can review the source of _csv.py since it’s written in pure python. Thanks to some input in pypy issue tracker https://bugs.pypy.org/issue641
  17. I was able to after a number of attempts modify _csv.py so that bm_csv benchmark performed at the same speed as cpython. This also gave a small performance improvement in the bm_csv2xml benchmark. Based on thee improvements, it is very likely we can use pypy in place of cpython for the ETL where we load csv files and convert to xml. I also intend to investigate where the performance bottlenecks are in the other ETL process benchmarks to see if we can get the gains sinmilar to what we get with pypy for the bm_csv2xml benchmark.
  18. If we revisit the definition of production ready, certainly if we just use items 1-7 as the criteria, pypy is certainly production ready when compared with other python implementations that are being used in production. If you want to run existing python code under pypy, then pypy compatibility with non standard python libraries needs to be considered and getting your hands dirty by running the code under pypy is really the best way to see if pypy will work. If nothing else you can report an issue to the pypy team and they can use it to improve compatibility. And will our company be deploying anything in production under pypy? It is likely sometime this year we will look at deploying it for certain ETL workloads due to measured benchmark performance. The additional memory overhead isn’t an issue for us. So my recommendation is that if you are looking for performance improvements, give pypy a go, you may be surprised.But performance shouldn’t be the only reason to consider pypy, there are various pypy side projects that will have good benefits for the python community as a whole. Last week the pypy team released cffi Foreign Function Interface for Python calling C code. The aim of this project is to provide a convenient and reliable way of calling C code from Python. It is
  19. But performance shouldn’t be the only reason to consider pypy, there are various pypy side projects that will have good benefits for the python community as a whole. Last year the pypy team released cffi Foreign Function Interface for Python calling C code. The aim of this project is to provide a convenient and reliable way of calling C code from Python. It works with both pypy and cpython 2.6+. The pypy team are working a pypy implementation of numpy and are close to a py3k language compliant version. If you want to help with pypy, check out the howto help page &amp; the donation page.
  20. pypy on ARM is 3 times faster than cpython on the ARM and they still do believe there will be more gains as the assembler output is optimized. I didn’t have a chance to run a complete set of benchmarks but initial results prove the 3 times claim.
  21. To illustrate how cffi can simplify the integration of cpython &amp; pypy with C libraries, let’s use a simple example. To call the C crypt function from Python with ctypes to must identify the C types for the input arguments and result type programmatically. Also to access the result it is via contents.value attribute.
  22. With cffi we can copy &amp; paste the man page definition of the crypt function, cffi works out the input argument and result types. A C compiler is required to be installed during development but not for distributed modules.Cffi is shippedwith pypy 2.0. Available for Python 2.6+ and Python 3.2 as a pypi install.Cffi speed is comparable to ctypes on CPython (a bit faster but a higher warm-up time). It is already faster on PyPy (1.5x-2x).