PyPy is a Python implementation that uses a just-in-time (JIT) compiler. It is written in RPython, a restricted subset of Python, and uses a translation framework to generate C code from RPython programs. This allows PyPy to run programs faster than the standard CPython implementation while also supporting features like lazy evaluation, pluggable object spaces, and stackless concurrency.
6. What PyPy is Python implemented in Python looks like this: $> python py.py
7. What PyPy is Python implemented in Python looks like this: runs on top of CPython $> python py.py
8. What PyPy is Python implemented in Python looks like this: runs on top of CPython about 2000 times slower than CPython $> python py.py
9. What PyPy is 2. Translation Framework $> python py.py $> ./pypy-c $> ./pypy-jvm $> ./pypy-cli
10. some PyPy facts founded in 2003 by Holger Krekel and Armin Rigo 2004 - 2007 EU Project - Sixth Framework since 2007 Open Source Project occasional Funding by Google Sprint-Driven Development
14. PyPy components RPython RPython = Restricted/Reduced Python Restricted = most possible static subset of Python
15. PyPy components RPython RPython = Restricted/Reduced Python Restricted = most possible static subset of Python required to perform Type Inference
16. PyPy components RPython RPython = Restricted/Reduced Python Restricted = most possible static subset of Python required to perform Type Inference input to the Translation Framework
17. PyPy components RPython RPython = Restricted/Reduced Python Restricted = most possible static subset of Python required to perform Type Inference input to the Translation Framework no real specification - just some hints
18. PyPy components RPython RPython = Restricted/Reduced Python Restricted = most possible static subset of Python required to perform Type Inference input to the Translation Framework no real specification - just some hints used for writing interpreters
19. PyPy components RPython RPython = Restricted/Reduced Python Restricted = most possible static subset of Python required to perform Type Inference input to the Translation Framework no real specification - just some hints used for writing interpreters can be used for writing extensions as well
31. PyPy > CPython High Level Language Implementation JIT Generation Object Spaces Stackless
32. PyPy > CPython High Level Language Implementation easy to experiment with
33. PyPy > CPython High Level Language Implementation easy to experiment with easy to implement new features
34. PyPy > CPython High Level Language Implementation easy to experiment with easy to implement new features lazily computed objects and functions
35. PyPy > CPython High Level Language Implementation easy to experiment with easy to implement new features lazily computed objects and functions plug-able garbage-collection
36. PyPy > CPython High Level Language Implementation easy to experiment with easy to implement new features lazily computed objects and functions plug-able garbage-collection runtime replacement of live-objects
37. PyPy > CPython High Level Language Implementation easy to experiment with easy to implement new features lazily computed objects and functions plug-able garbage-collection runtime replacement of live-objects stackless concurrency
38. PyPy > CPython JIT Generation based on Partial Evaluation via Yoshihiko Futamura (1971). "Partial Evaluation of Computation Process – An Approach to a Compiler-Compiler"
39. PyPy > CPython JIT Generation based on Partial Evaluation via Yoshihiko Futamura (1971). "Partial Evaluation of Computation Process – An Approach to a Compiler-Compiler" says: it's possible to take an interpreter and transform it into a compiler
40. PyPy > CPython JIT Generation based on Partial Evaluation via Yoshihiko Futamura (1971). "Partial Evaluation of Computation Process – An Approach to a Compiler-Compiler" says: it's possible to take an interpreter and transform it into a compiler means: having such a thing is pretty cool because writing interpreters is a lot easier than writing compilers.
44. Thunk Object Space provides: lazily computed objects lazily computed functions globally replaceable objects is implemented in about 200 lines of code
45. Thunk Object Space provides: lazily computed objects lazily computed functions globally replaceable objects is implemented in about 200 lines of code Example: >>>> a = "hello" >>>> b = "world" >>>> a + b 'helloworld' >>>> become(a,b) >>>> a + b 'worldworld'
46. Taint Object Space provides protection for : sensitive data that should not leak
47. Taint Object Space provides protection for : sensitive data that should not leak provides protection from : untrusted data that needs to be validated
48. Taint Object Space provides protection for : sensitive data that should not leak provides protection from : untrusted data that needs to be validated Example: >>>> password = "secret" >>>> password 'secret' >>>> password = taint("secret") >>>> password Traceback (application-level): File "<inline>", line 1 in <interactive> password TaintError
49. PyPy > CPython Stackless infinite Recursion CPython limited to depth=1000 regular PyPy limited to depth=5000
50. PyPy > CPython Stackless infinite Recursion CPython limited to depth=1000 regular PyPy limited to depth=5000 Microthreads Coroutines Tasklets and Channels Greenlets
51. PyPy > CPython Stackless infinite Recursion CPython limited to depth=1000 regular PyPy limited to depth=5000 Microthreads Coroutines Tasklets and Channels Greenlets Coroutine Pickling Coroutine Cloning