The developers of the Pyston project, which offers a high-performance implementation of the Python language using modern JIT compiling technologies, have introduced the Pyston-lite extension with a JIT compiler implementation for CPython. While Pyston is a fork of the CPython codebase and is developed independently, Pyston-lite is designed as a universal extension that can be connected to the standard Python interpreter (CPython).
Pyston-lite allows the use of basic Pyston technologies without replacing the interpreter, through the installation of an additional extension using the package manager PIP or Conda. Pyston-lite is now available in the PyPI and Conda repositories, and to install it, you can simply run the command 'pip install pyston_lite_autoload' or 'conda install pyston_lite_autoload -c pyston'. Two packages are offered: pyston_lite (the JIT itself) and pyston_lite_autoload (which performs automatic JIT substitution when starting a Python process). It is also possible to programmatically control the JIT activation from the application without installing the autoload module, using the function pyston_lite.enable().
Although Pyston-lite does not cover all the optimizations available in Pyston, its use enables performance improvements of approximately 10-25% compared to standard Python 3.8. Future plans include transferring most of the optimizations present in Pyston to Pyston-lite, as well as expanding the supported versions of CPython (the first release only supports Python 3.8). More broadly, collaboration with the CPython team is planned to implement new APIs for JIT, allowing for greater control over Python's operation. Proposed changes are being discussed for inclusion in the Python 3.12 branch. Ideally, there is consideration of transferring all functionality from Pyston to an extension, which would eliminate the need to maintain a separate CPython fork.
In addition to Pyston-lite, the project has also released an update for the full Pyston package, version 2.3.4, which includes new optimizations. In the pyperformance test, version 2.3.4 is approximately 6% faster than version 2.3.3. The overall performance gain compared to CPython is estimated at 66%.
Additionally, it is noteworthy that optimizations developed within the CPython 3.11 development cycle have significantly improved performance in the main project, allowing for a 25% increase in some tests. For instance, CPython 3.11 has enhanced the efficiency of bytecode caching for core modules, which will speed up script launches by 10-15%. Function calls have been significantly accelerated and specialized fast interpreters for common operations have been added. Work is also underway to transfer some optimizations prepared by the Cinder and HotPy projects.
Additionally, the nogil project is working on an experimental mode for building CPython without the Global Interpreter Lock (GIL), which prevents parallel access to shared objects from different threads, hindering the parallelization of operations on multi-core systems. As an alternative solution to the GIL issue, there is development underway to bind individual GILs to each interpreter running within a process (multiple interpreters can run in a single process, but their parallel execution efficiency is limited by the GIL).
Source: opennet.ru
