|
|
|
|
|
by ghj
2001 days ago
|
|
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) |
|
[1] https://docs.python.org/3/library/array.html