is it ready for production? the sequel Mark Rees CTO Century Software (M) Sdn Bhd
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 what is pypy? - RPython translation toolchain, a framework for generating dynamic programming language implementations - a implementation of Python in Python using the framework 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
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
modified csv pypy benchmarks https://bitbucket.org/hexdump42/pypy-benchmarks average execution time (in seconds) benchmark cpython pypy-jit pypy-jit 2.7.3 1.9 2.0.2 bm_csv2xml_mod 88.25/90.0 23.65 3.7315 x 21.76 4.0556 x 2 faster faster bm_csv_mod 1.62/1.69 1.89 0.8571 x 1.68 0.9643 x slower slower
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