News for hackers. Stuff that matters.
Re:PyPy Project looking for sponsorship to add support for A... by gabagool on Thursday December 31, 2020 @02:33PM (#25596225)
Why do competitive Python programmers use PyPy instead of CPython?
Re:PyPy Project looking for sponsorship to add support for A... by ghj on Thursday December 31, 2020 @03:13PM (#25596638)
PyPy is easily 10x faster than CPython at numeric stuff, which is 99% of these contest problems.

For example, using CPython, if you try to make an array of a million ints, you won't get `int[1000000]` in your memory layout. Each int would actually be an object, which is huge and inefficient to reference (they are something like 24+ bytes each).

PyPy on the other hand, works as expected.

I think the more important point is that PyPy when written like C code, can actually get within 2x of the performance of C code. If it's any slower, python won't be a viable language in competitive programming at all.

(CPython is sometimes still used on other platforms like atcoder.jp, but only because they allow third party libraries like numba and numpy which can fill the same role pypy does)

Re:PyPy Project looking for sponsorship to add support for A... by simple_phrases on Thursday December 31, 2020 @05:55PM (#25598165)
For that particular use case, how does PyPy perform in comparison to CPython's array module[1]?

[1] https://docs.python.org/3/library/array.html

Re:PyPy Project looking for sponsorship to add support for A... by spicybright on Thursday December 31, 2020 @08:31PM (#25599791)
Why doesn't the community collectively switch over to PyPy? It seems like it's better in all reguards.
Re:PyPy Project looking for sponsorship to add support for A... by semi-extrinsic on Thursday December 31, 2020 @08:59PM (#25600012)
Library support?
Re:PyPy Project looking for sponsorship to add support for A... by sitkack on Thursday December 31, 2020 @09:17PM (#25600150)
The cabal that runs CPython ignores both standardization, the standard library and interop with other implementations.

PyPy shouldn't be the new default, but neither should be CPython.

Re:PyPy Project looking for sponsorship to add support for A... by spicybright on Friday January 01, 2021 @02:06PM (#25605748)
Don't you have to choose one or the other tho lol
Re:PyPy Project looking for sponsorship to add support for A... by neolog on Thursday December 31, 2020 @02:55PM (#25596420)
PyPy is much faster than CPython.
Re:PyPy Project looking for sponsorship to add support for A... by Guthur on Thursday December 31, 2020 @05:37PM (#25597975)
For some cases, and the picture often changes.

We were using pypy because it was better for our use case at one point but then later on we retested cpython and found the picture had changed.

We believe this was due to significant improvements in the regex engine for cpython over the period, but could also be due to our code base changing.

The point being it is not a given that pypy is faster.