📜 ⬆️ ⬇️

PyPy 1.2 came out and accelerated Python at times!

PyPy 1.2 released. The main difference is the presence of a JIT compiler .
In order not to explain for a long time what it is and why - a simple test:

  cnt = 10 * 1000 * 1000
 for _ in xrange (cnt): 
     i = i + 1 


5.8million addition operations per second on regular Python 2.6 ( python test.py )
42.5m operations per second on PyPy 1.2 ( pypy test.py )
WinXP SP3, Core2Duo.
')
Yes, he did the test 7 times faster ! And this is not only on a synthetic test: “django” is 3 times faster, “n-body” is 7 times faster ... I do not know what the “richards” test is, but now it is almost 12 times faster. See the results yourself .

Read and download (from the section "" JIT compiler "version"). 64-bit version yet. And unladen-swallow nervously smokes ... Under the cut are a few more incredibles (stackless, “sandbox for python code”) ..

Their archives also have a stackless version ... and most importantly a sandbox version! This is the version that solves the long-standing problem of Python, the lack of a secure environment for executing code that we do not trust. The external C code will not even allow os.listdir('/') , if I understood the authors' hint correctly. Swings in the same place as usual.

Personally, I generally looked at PyPy as a strange experiment - Python and not to say that it was super-fast, but to write its interpreter on Python itself seemed just like a weird author's strange entertainment ... However, with the introduction of JIT, it became something incredible in speed.

The authors say that this version of crash is not observed, but nevertheless they ask to treat this version as a beta anyway.

In addition, the authors warn that, due to the use of JIT, it is still difficult to control the amount of memory that this Python consumes. But here in essence the “speed-memory tradeoff” is obtained in its pure form.

For me, as a big Python fan, and for the language as a whole, this is just a real breakthrough. Now I will closely monitor their development. There are of course in it and tests for which CPython wins, but they are much smaller than those for which it loses. And the gain is not just there 10-20%, but 3x, 5x, 8x times! In general, it sounds incredible, but the guys from PyPy invented the V8 but for Python.

How to use?

Download , unpack, instead of python -.py run pypy -.py

Yoi Haji
view from Habra

Source: https://habr.com/ru/post/87364/


All Articles