Python compiler

Правка en1, от alextretyak, 2022-06-11 09:00:58

As you know, the performance of the Python reference implementation (CPython) and even the PyPy JIT compiler is sometimes not enough to solve problems (the solution does not fit into the time limit).

I present to your attention a transpiler that translates Python code into C++ in such a way that the performance of the generated code is almost as good as the "manual" implementation of the problem in C++.

Here is a link to the project page: https://11l-lang.org/transpiler

Not all of Python is supported, but its subset enough to solve almost any competitive programming problem (this transpiler was tested on existing solutions for more than 500 Codeforces problems of different difficulty).

The disadvantage of this project is a significant number of nuances and peculiarities that must be taken into account when writing the program code in Python, so that it compiles correctly with this transpiler. But I think it's not such a big price to pay for the ability to solve tasks in Python that only C/C++ and other compiled languages can handle at the moment. (Most of these nuances and peculiarities are listed in this guide.)

The only alternative to this transpiler with comparable speed is essentially only Cython, but there you have to practically rewrite the code to achieve comparable performance. And the code for the ‘Prime number’ problem, given on the page https://11l-lang.org/transpiler, is compiled by this transpiler as is, unlike Cython.

If there will be a sufficiently large number of Codeforces members who support this project, there is a chance it will be added to the supported compilers in Codeforces [along with PyPy which, although inferior to this transpiler in performance, has better Python support].

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en1 Английский alextretyak 2022-06-11 09:00:58 1803 Initial revision for English translation
ru1 Русский alextretyak 2022-06-11 09:00:20 1932 Первая редакция (опубликовано)