Pyston 2 an implementation of Python with a JIT compiler

After a three-year hiatus in development, the launch of the Pyston 2 project has been published, what did i developto a high-performance implementation of the Python language using the developments of the LLVM project.

The implementation stands out for the use of modern JIT compilation technologies and aims to achieve high performance similar to traditional system languages ​​like C ++.

The code from previous versions by Pyston was distributed under the Apache license, but Pyston 2 code is not yet available and only ready-to-use builds are released for Ubuntu 18.04 and 20.04 (a file with the code is available for download but there is only a stub with information that the project is still closed) .

Publishing the code is part of the developers' plansbut this will be done after business model formation has been completed of the new company and it was decided to continue developing Pyston without the financial support of Dropbox.

About Pyston 2

Unlike previous versions, Pyston 2 is marked stable and not as a trial version. Much work has been done to optimize performance and Pyston 2 is now faster than the original Python 3.8 by about 20% when passing the python-macrobenchmarks test suite.

The most notable performance gains are seen in inherent web application workloads. In separate tests like chaos.py and nbody.py, Pyston 2 outperforms Python 3.8 by a factor of 2. The cost of using JIT is a slight increase in memory consumption.

We are very excited to release Pyston v2, a faster and highly compatible implementation of the Python programming language. Version 2 is 20% faster than the standard Python 3.8 in our macrobenchmarks. More importantly, it is likely faster in your code. Pyston v2 can reduce server costs, reduce user latencies, and improve developer productivity.

Pyston v2 is easy to implement, so if you are looking for better Python performance, we recommend that you take five minutes and give Pyston a try. Doing so is one of the easiest ways to speed up your project.

In terms of compatibility with native Python, the Pyston project touted as the most CPython-compatible alternative implementation, since Pyston is a fork of the main CPython codebase.

Pyston supports all CPython functions, including the C API for developing C extensions. Pyston was originally developed by Dropbox, which in 2017 decided to discontinue internal development. In early 2020, Pyston's top developers founded their company, completely reinvented the project, and began working at Pyston full-time.

Technical details on Pyston 2 padding are not provided yet, only DynASM JIT, inline caching, and general CPython optimizations are mentioned. The previous version of Pyston used one method JIT at a time, similar to the JIT in modern JavaScript engines.

In JIT, the Python code was parsed and translated to an intermediate representation LLVM (IR, Intermediate representation). Furthermore, the IR representation was processed in the LLVM optimizer and passed to the LLVM JIT engine for execution, which converted the IR representation into machine code.

To obtain information on the types of variables for programs in the dynamic Python language, the technique of probabilistic prediction of object types was used, followed by the clarification of the correct choice of type during execution.

Therefore, Pyston constantly varied the execution between two branches: the fast, when the predicted rates are confirmed, and the slow, which is used in case of a type mismatch.

The job could be done in multithreaded mode, allowing the parallel execution of several code threads in the Python language and free of the global interpreter lock (GIL).

Finally if you want to know more about it, you can check the details in the following link


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published.

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.