1 / 14
Jul 2012

When solving problem sets on SPOJ, pypy is much faster than traditional CPython. But unfortunately, pypy is not supported currently.

I'm working on BITMAP. With cPython, my code could finish a 182x182 test case in about 5s. Same test could be finished in 1.2s with Pypy. As I know, many people here use psyco module to optimize running time. But this module has been deprecated, and pypy would be a much better choice.

Does SPOJ team have any plan adding pypy support ?

26 days later

After thinking about it and doing some experiments, here are my recommendations according "the future of SPOJ and Python":

First some facts:
- Psyco is dead. Beyond Python 2.6 there is no psyco anymore.
- Pypy is alive, the latest stable version (1.9) is compatible with Python 2.7, and development is going on.
- Pypy is much faster than pure CPython, speed is comparable to Python + psyco.
- SPOJ offeres two different Python-Versions for some time, now (> 2 years, if I remember right)
- The Python 3.1 installation has no problems, works stable
- The Python 2.5 installation (now labeled as Python 2.7, but in fact still Python 2.5) makes some trouble from time to time.

Then my recommendations:
- Python 3.x should be maintained - of course. From time to time it should be updated as you can expect some improvements (speeding up e.g.). Newbies mostly will learn Python 3.x nowadays and thus can use SPOJ as a playground.
- The Python 2.x branch should also be maintained, but the standard CPython should be replaced by pypy. What are the reasons for that recommendation:
- "Older Pythonistas" are familiar with Python 2.x and prefer Python 2.x over Python 3.x.
- Python is a great language, but speed doesn't belong to its strengths. So there are many SPOJ problems that are impossible to solve with standard CPython, some others require special optimizations to speed up and some even need hard optimizations and the use of psyco to get AC, even though it may be algorithmically easy ones that can be implemenented straight forward in a faster language to get AC. So, the use of pypy will be an important contribution to have Python as a competitive language among the languages offered by SPOJ. It will reduce the need of special optimizations and reduce the time working on those things - instead the algorithm and its proper implementation will be in the focus.

I hope that some other Python users share my view and that the admins can be convinced to go that way.

+1 with numerix, for all that is said.

The future for Python is definitively
Py3.3 (+pypy in soon future)
and yet
Py2 + pypy

I can understand that it need some work, some experiment, it'll led to some transition, and perhaps some trouble, but the most important is that python is a (the?) perfect language for learn algorithmic and thus should be as possible up to date.

I don't mind if there's sometimes some trouble, and need two or three submissions to catch a functional server. But I know that this opinion is not shared at 100%.

+1 with both of you. For me it is annoying to struggle with optimization issues of an out-of-date package like psyco to get accomplished (even if my algorithm is correct and almost efficient).

12 days later

I strongly agree with the above presented views.

I prefer to use Python over other languages but usually forced to retreat to C family since some of the problems are impossible with Python. With Pypy being 5.67x faster than CPython (on an average) speed.pypy.org/1, this can make many problems approachable.

19 days later

No pypy, yet! frowning

But: Python 3 version has been changed, and it hasn't become better.
Actual state (2012-09-27) is:
Python 3.2.3, uses 12 MB and has a startup time around 0.5 s. frowning
Python 2.5.0, uses 3.7 MB and has a startup time around 0.03 s. Labeled as Python 2.7. frowning

After the sad news, a better with the cube cluster, we have today :
TEST possible in 0.00s in python2.? and in 0.01s in python3.?

On cube cluster, py2.5 and py3.1 should be present, with 3.7MB and 5.6MB of memory print.

+1 for waiting for pypy.

Well, even a quite simple problem with a time limit of 0.4 secs hosted on the new cube (Sum of Subsets ) appears not to be solvable using Python 3... confused

There's yet two AC, didn't you saw ?

ups, sorry, that's embarassing! blush
I definitely overlooked these two.

So my algo, which seems competible in Python 2 (0.17 secs, same as numerix wink ), must be slow in Python 3... But that is off-topic, I don't want to mis-use this thread. It should be a plea for introducing PyPy.

Still no pypy! cry cry

But other changes seem to have been done. Todays state (2012-10-11):

Pyramid-Cluster
Python 2.7.2, startup time 0.11 s, 4.5 MB, no psyco available
Python 3.2.3, startup time 0.48 s, 12 MB

Cube-Cluster
Python 2.5.0, startup time 0.00 s, 3.6 MB, psyco available
Python 3.1.2, startup time 0.01 s, 5.6 MB

4 months later

I too support pypy! I would be a lot more active if it were supported.

1 year later

Just started on SPOJ, (after Project Euler had to take a break due to its website being hacked) and I'm missing the performance PyPy delivers very much. With PyPy my Python programs often were competitive, some times faster than those written in C++. Here there are a lot of problems I can't even get close to finishing in spite of using sophisticated algos.
Therefore I would very much wellcome using PyPy being used as substitution for CPython for Python 2.7.