| 1 |
============ |
| 2 |
PyPy 4.0.0 |
| 3 |
============ |
| 4 |
|
| 5 |
We're pleased and proud to unleash PyPy 4.0.0, a major update of the PyPy |
| 6 |
python 2.7.10 compatible interpreter with a Just In Time compiler. |
| 7 |
We have improved `warmup time and memory overhead used for tracing`_, added |
| 8 |
`vectorization`_ for numpy and general loops where possible on x86 hardware |
| 9 |
(disabled by default), |
| 10 |
refactored rough edges in rpython, and increased functionality of numpy. |
| 11 |
|
| 12 |
You can download the PyPy 4.0.0 release here: |
| 13 |
|
| 14 |
https://pypy.org/download.html |
| 15 |
|
| 16 |
We would like to thank our donors for the continued support of the PyPy |
| 17 |
project. |
| 18 |
|
| 19 |
We would also like to thank our contributors (7 new ones since PyPy 2.6.0) and |
| 20 |
encourage new people to join the project. PyPy has many |
| 21 |
layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation |
| 22 |
improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ |
| 23 |
with making RPython's JIT even better. |
| 24 |
|
| 25 |
New Version Numbering |
| 26 |
===================== |
| 27 |
|
| 28 |
Since the past release, PyPy 2.6.1, we decided to update the PyPy 2.x.x |
| 29 |
versioning directly to PyPy 4.x.x, to avoid confusion with CPython 2.7 |
| 30 |
and 3.5. Note that this version of PyPy uses the stdlib and implements the |
| 31 |
syntax of CPython 2.7.10. |
| 32 |
|
| 33 |
Vectorization |
| 34 |
============= |
| 35 |
|
| 36 |
Richard Plangger began work in March and continued over a Google Summer of Code |
| 37 |
to add a `vectorization` step to the trace optimizer. The step recognizes common |
| 38 |
constructs and emits SIMD code where possible, much as any modern compiler does. |
| 39 |
This vectorization happens while tracing running code, so it is actually easier |
| 40 |
at run-time to determine the |
| 41 |
availability of possible vectorization than it is for ahead-of-time compilers. |
| 42 |
|
| 43 |
Availability of SIMD hardware is detected at run time, without needing to |
| 44 |
precompile various code paths into the executable. |
| 45 |
|
| 46 |
The first version of the vectorization has been merged in this release, since |
| 47 |
it is so new it is off by default. To enable the vectorization in built-in JIT |
| 48 |
drivers (like numpy ufuncs), add `--jit vec=1`, to enable all implemented |
| 49 |
vectorization add `--jit vec_all=1` |
| 50 |
|
| 51 |
Benchmarks and a summary of this work appear `here`_ |
| 52 |
|
| 53 |
Internal Refactoring: Warmup Time Improvement and Reduced Memory Usage |
| 54 |
====================================================================== |
| 55 |
|
| 56 |
Maciej Fijalkowski and Armin Rigo refactored internals of rpython that now allow |
| 57 |
PyPy to more efficiently use `guards`_ in jitted code. They also rewrote |
| 58 |
unrolling, leading to a warmup time improvement of 20% or so. The reduction in |
| 59 |
guards also means a reduction in the use of memory, also a savings of around |
| 60 |
20%. |
| 61 |
|
| 62 |
Numpy |
| 63 |
===== |
| 64 |
|
| 65 |
Our implementation of `numpy`_ continues to improve. ndarray and the numeric dtypes |
| 66 |
are very close to feature-complete; record, string and unicode dtypes are mostly |
| 67 |
supported. We have reimplemented numpy linalg, random and fft as cffi-1.0 |
| 68 |
modules that call out to the same underlying libraries that upstream numpy uses. |
| 69 |
Please try it out, especially using the new vectorization (via `--jit vec=1` on the |
| 70 |
command line) and let us know what is missing for your code. |
| 71 |
|
| 72 |
CFFI |
| 73 |
==== |
| 74 |
|
| 75 |
While not applicable only to PyPy, `cffi`_ is arguably our most significant |
| 76 |
contribution to the python ecosystem. Armin Rigo continued improving it, |
| 77 |
and PyPy reaps the benefits of `cffi-1.3`_: improved management of object |
| 78 |
lifetimes, __stdcall on Win32, ffi.memmove(), and percolate ``const``, |
| 79 |
``restrict`` keywords from cdef to C code. |
| 80 |
|
| 81 |
.. _`warmup time and memory overhead used for tracing`: https://morepypy.blogspot.com/2015/10/pypy-memory-and-warmup-improvements-2.html |
| 82 |
.. _`vectorization`: https://pypyvecopt.blogspot.co.at/ |
| 83 |
.. _`guards`: https://rpython.readthedocs.org/en/latest/glossary.html |
| 84 |
.. _`PyPy`: https://doc.pypy.org |
| 85 |
.. _`RPython`: https://rpython.readthedocs.org |
| 86 |
.. _`cffi`: https://cffi.readthedocs.org |
| 87 |
.. _`cffi-1.3`: https://cffi.readthedocs.org/en/latest/whatsnew.html#v1-3-0 |
| 88 |
.. _`modules`: https://doc.pypy.org/project-ideas.html#make-more-python-modules-pypy-friendly |
| 89 |
.. _`help`: https://doc.pypy.org/project-ideas.html |
| 90 |
.. _`numpy`: https://bitbucket.org/pypy/numpy |
| 91 |
|
| 92 |
What is PyPy? |
| 93 |
============= |
| 94 |
|
| 95 |
PyPy is a very compliant Python interpreter, almost a drop-in replacement for |
| 96 |
CPython 2.7. It's fast (`pypy and cpython 2.7.x`_ performance comparison) |
| 97 |
due to its integrated tracing JIT compiler. |
| 98 |
|
| 99 |
We also welcome developers of other |
| 100 |
`dynamic languages`_ to see what RPython can do for them. |
| 101 |
|
| 102 |
This release supports **x86** machines on most common operating systems |
| 103 |
(Linux 32/64, Mac OS X 64, Windows 32, OpenBSD_, freebsd_), |
| 104 |
as well as newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux. |
| 105 |
|
| 106 |
We also introduce `support for the 64 bit PowerPC`_ hardware, specifically |
| 107 |
Linux running the big- and little-endian variants of ppc64. |
| 108 |
|
| 109 |
.. _`pypy and cpython 2.7.x`: https://speed.pypy.org |
| 110 |
.. _OpenBSD: https://cvsweb.openbsd.org/cgi-bin/cvsweb/ports/lang/pypy |
| 111 |
.. _freebsd: https://svnweb.freebsd.org/ports/head/lang/pypy/ |
| 112 |
.. _`dynamic languages`: https://pypyjs.org |
| 113 |
.. _`support for the 64 bit PowerPC`: https://morepypy.blogspot.com/2015/10/powerpc-backend-for-jit.html |
| 114 |
.. _`here`: https://morepypy.blogspot.com/2015/10/automatic-simd-vectorization-support-in.html |
| 115 |
|
| 116 |
Other Highlights (since 2.6.1 release two months ago) |
| 117 |
===================================================== |
| 118 |
|
| 119 |
* Bug Fixes |
| 120 |
|
| 121 |
* Applied OPENBSD downstream fixes |
| 122 |
|
| 123 |
* Fix a crash on non-linux when running more than 20 threads |
| 124 |
|
| 125 |
* In cffi, ffi.new_handle() is more cpython compliant |
| 126 |
|
| 127 |
* Accept unicode in functions inside the _curses cffi backend exactly like cpython |
| 128 |
|
| 129 |
* Fix a segfault in itertools.islice() |
| 130 |
|
| 131 |
* Use gcrootfinder=shadowstack by default, asmgcc on linux only |
| 132 |
|
| 133 |
* Fix ndarray.copy() for upstream compatibility when copying non-contiguous arrays |
| 134 |
|
| 135 |
* Fix assumption that lltype.UniChar is unsigned |
| 136 |
|
| 137 |
* Fix a subtle bug with stacklets on shadowstack |
| 138 |
|
| 139 |
* Improve support for the cpython capi in cpyext (our capi compatibility |
| 140 |
layer). Fixing these issues inspired some thought about cpyext in general, |
| 141 |
stay tuned for more improvements |
| 142 |
|
| 143 |
* When loading dynamic libraries, in case of a certain loading error, retry |
| 144 |
loading the library assuming it is actually a linker script, like on Arch |
| 145 |
and Gentoo |
| 146 |
|
| 147 |
* Issues reported with our previous release were resolved_ after reports from users on |
| 148 |
our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at |
| 149 |
#pypy |
| 150 |
|
| 151 |
* New features: |
| 152 |
|
| 153 |
* Add an optimization pass to vectorize loops using x86 SIMD intrinsics. |
| 154 |
|
| 155 |
* Support __stdcall on Windows in CFFI |
| 156 |
|
| 157 |
* Improve debug logging when using PYPYLOG=??? |
| 158 |
|
| 159 |
* Deal with platforms with no RAND_egd() in OpenSSL |
| 160 |
|
| 161 |
* Numpy: |
| 162 |
|
| 163 |
* Add support for ndarray.ctypes |
| 164 |
|
| 165 |
* Fast path for mixing numpy scalars and floats |
| 166 |
|
| 167 |
* Add support for creating Fortran-ordered ndarrays |
| 168 |
|
| 169 |
* Fix casting failures in linalg (by extending ufunc casting) |
| 170 |
|
| 171 |
* Recognize and disallow (for now) pickling of ndarrays with objects |
| 172 |
embedded in them |
| 173 |
|
| 174 |
* Performance improvements and refactorings: |
| 175 |
|
| 176 |
* Reuse hashed keys across dictionaries and sets |
| 177 |
|
| 178 |
* Refactor JIT internals to improve warmup time by 20% or so at the cost of a |
| 179 |
minor regression in JIT speed |
| 180 |
|
| 181 |
* Recognize patterns of common sequences in the JIT backends and optimize them |
| 182 |
|
| 183 |
* Make the garbage collector more incremental over external_malloc() calls |
| 184 |
|
| 185 |
* Share guard resume data where possible which reduces memory usage |
| 186 |
|
| 187 |
* Fast path for zip(list, list) |
| 188 |
|
| 189 |
* Reduce the number of checks in the JIT for lst[a:] |
| 190 |
|
| 191 |
* Move the non-optimizable part of callbacks outside the JIT |
| 192 |
|
| 193 |
* Factor in field immutability when invalidating heap information |
| 194 |
|
| 195 |
* Unroll itertools.izip_longest() with two sequences |
| 196 |
|
| 197 |
* Minor optimizations after analyzing output from `vmprof`_ and trace logs |
| 198 |
|
| 199 |
* Remove many class attributes in rpython classes |
| 200 |
|
| 201 |
* Handle getfield_gc_pure* and getfield_gc_* uniformly in heap.py |
| 202 |
|
| 203 |
* Improve simple trace function performance by lazily calling fast2locals |
| 204 |
and locals2fast only if truly necessary |
| 205 |
|
| 206 |
.. _`vmprof`: https://vmprof.readthedocs.org |
| 207 |
.. _resolved: https://doc.pypy.org/whatsnew-15.11.0.html |
| 208 |
|
| 209 |
Please try it out and let us know what you think. We welcome feedback, |
| 210 |
we know you are using PyPy, please tell us about it! |
| 211 |
|
| 212 |
Cheers |
| 213 |
|
| 214 |
The PyPy Team |
| 215 |
|