pypy

Why is pow(a, d, n) so much faster than a**d % n?

Why is pow(a, d, n) so much faster than a**d % n? Question: I was trying to implement a Miller-Rabin primality test, and was puzzled why it was taking so long (> 20 seconds) for midsize numbers (~7 digits). I eventually found the following line of code to be the source of the problem: x …

Total answers: 4

how to create virtualenv with pypy?

how to create virtualenv with pypy? Question: running the following command virtualenv -p /usr/local/bin/pypy pypy exits with error like Running virtualenv with interpreter /usr/local/bin/pypy New pypy executable in pypy/bin/pypy debug: WARNING: Library path not found, using compiled-in sys.path. debug: WARNING: ‘sys.prefix’ will not be set. debug: WARNING: Make sure the pypy binary is kept inside …

Total answers: 5

Why wasn't PyPy included in standard Python?

Why wasn't PyPy included in standard Python? Question: I was looking at PyPy and I was just wondering why it hasn’t been adopted into the mainline Python distributions. Wouldn’t things like JIT compilation and lower memory footprint greatly improve the speeds of all Python code? In short, what are the main drawbacks of PyPy that …

Total answers: 6

How do you get PyPy, Django and PostgreSQL to work together?

How do you get PyPy, Django and PostgreSQL to work together? Question: What fork, or combination of packages should one to use to make PyPy, Django and PostgreSQL play nice together? I know that PyPy and Django play nice together, but I am less certain about PyPy and PostgreSQL. I do see that Alex Gaynor …

Total answers: 2

Does PyPy translate itself?

Does PyPy translate itself? Question: Am I getting this straight? Does the PyPy interpreter actually interpret itself and then translate itself? So here’s my current understanding: RPython’s toolchain involves partially executing the program to be translated to get a sort of preprocessed version to annotate and translate. The PyPy interpreter, running on top of CPython, …

Total answers: 2

Can PyPy/RPython be used to produce a small standalone executable?

Can PyPy/RPython be used to produce a small standalone executable? Question: (Or, “Can PyPy/RPython be used to compile/translate Python to C/C++ without requiring the Python runtime?”) I have tried to comprehend PyPy with its RPython and its Python, its running and its compiling and its translating, and have somewhat failed. I have a hypothetical Python …

Total answers: 1

Eventlet or gevent or Stackless + Twisted, Pylons, Django and SQL Alchemy

Eventlet or gevent or Stackless + Twisted, Pylons, Django and SQL Alchemy Question: We’re using Twisted extensively for apps requiring a great deal of asynchronous io. There are some cases where stuff is cpu bound instead and for that we spawn a pool of processes to do the work and have a system for managing …

Total answers: 4

PyPy — How can it possibly beat CPython?

PyPy — How can it possibly beat CPython? Question: From the Google Open Source Blog: PyPy is a reimplementation of Python in Python, using advanced techniques to try to attain better performance than CPython. Many years of hard work have finally paid off. Our speed results often beat CPython, ranging from being slightly slower, to …

Total answers: 4

What does PyPy have to offer over CPython, Jython, and IronPython?

What does PyPy have to offer over CPython, Jython, and IronPython? Question: From what I have seen and read on blogs, PyPy is a very ambitious project. What are some advantages it will bring to the table over its siblings (CPython, Jython, and IronPython)? Is it speed, cross-platform compatibility (including mobile platforms), the ability to …

Total answers: 4