Improve operational efficiency -pypy python

pypy Download: https://bitbucket.org/pypy/pypy/downloads/

If the download is too slow, go to my Web site to download

https://pan.baidu.com/s/1i6j0xt0boS5j26WXvH5mPw extraction code: gst2 

How to run pypy?

pypy program with the average python is the same, the code does not require any changes. When executed, the standard python with python xxx.py to perform, and pypy with pypy xxx.py like, there is no difference.

import time
t = time.time()
for i in range(10**8):
    continue
print(time.time() - t)
> Python my_numba.py #cpython interpreter
 3.958527088165283 
> PyPy my_numba.py #pypy interpreter
 0.110000133514

With cpython to test with a time of 3.958527088165283s, but only 0.110000133514s pypy test when used.

 

 

Note: pypy are independent with python, python installed in the library pypy is not used, python itself has a very big advantage is that third-party libraries for speed and abandon pypy of such resources a little pity.

pypy installation tripartite library:

git clone https://github.com/anpengapple/pypy_get_pip.git

 

 Enter the directory operation, if fails, then run more than a few times

pypy the get -pip.py

After running {pypy_dir} / bin directory and several pip more executable files.

 

Now you can use  {pypy_dir} / bin / pip install xxx  to install a third-party libraries. It should be noted that third-party libraries can not fully support. But most of them are possible.

Guess you like

Origin www.cnblogs.com/pfeiliu/p/12076711.html