alextretyak's blog

By alextretyak, history, 6 months ago, translation, In English

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].

 
 
 
 
  • Vote: I like it
  • +55
  • Vote: I do not like it

»
5 months ago, # |
  Vote: I like it -8 Vote: I do not like it

Hello sir. Interesting project you got in there. I have a few questions to the community here. Is this project still under development? Why is this blog ignored by everyone? Are there any volunteers for this project? Any Python coder here in codeforces who has tested this project in contests?

  • »
    »
    4 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Is this project still under development?

    Yes it is.

    Why is this blog ignored by everyone?

    I suppose because it did not show at the Codeforces main page. By the way, how did you find this blog post?

    Are there any volunteers for this project?

    Currently, I am the only developer on this project.

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

This is awesome! If it's refined more, the usage for python in CP might potentially increase waaaay more.

»
2 months ago, # |
  Vote: I like it +8 Vote: I do not like it

wow, that is nice. I am willing to help. just tell me how I can help I already shared the post with my frindes

  • »
    »
    2 months ago, # ^ |
    Rev. 2   Vote: I like it 0 Vote: I do not like it

    You can make a collection of Codeforces problems, which can not be solved with Python (CPython and PyPy) because of exceeding time/memory limit, but can be solved with this transpiler.

»
2 months ago, # |
  Vote: I like it +3 Vote: I do not like it

It sounds great! If python can be faster, more users will like python!