Developers of the Pyston project, which offers a high-performance implementation of the Python language using modern JIT compilation technologies, have presented the Pyston-lite extension with a JIT compiler implementation for CPython. While Pyston is a branch from the CPython codebase and develops independently, Pyston-lite is designed as a universal extension intended for use with the standard Python interpreter (CPython).
Pyston-lite allows users to utilize the core Pyston technologies without replacing the interpreter, by installing an additional extension via the package managers PIP or Conda. Pyston-lite is already available in PyPI and Conda repositories, and to install it, you 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 the Python process starts). It is also possible to programmatically control JIT activation from the application without installing the autoload module, using the function pyston_lite.enable().
Although Pyston-lite does not encompass all the optimizations available in Pyston, its usage allows for a performance increase of approximately 10-25% compared to standard Python 3.8. There are plans to migrate the majority of the optimizations present in Pyston into Pyston-lite in the future, as well as to expand the supported versions of CPython (the initial release only supports Python 3.8). Among broader plans, there is collaboration with the CPython team to implement new APIs for JIT, which would allow for more comprehensive control over Python's operation. There are discussions about incorporating suggested changes into the Python 3.12 branch. Ideally, there is consideration for migrating all functionality from Pyston into the 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 2.3.4, which includes new optimizations. In the pyperformance test, version 2.3.4 is about 6% faster than release 2.3.3. The overall performance gain compared to CPython is estimated at 66%.
Naviac možno spomenúť optimalizácie vyvíjané v rámci cyklu vývoja CPython 3.11 v hlavnom projekte, ktoré v niektorých testoch umožnili zvýšiť výkon o 25 %. Napríklad, v CPython 3.11 sa zvýšila účinnosť cacheovanie stavu bytecode základných modulov, čo urýchli spúšťanie skriptov o 10-15 %. Výrazne sa zrýchlili volania funkcií a boli pridané špecializované rýchle interpretery typových operácií. Taktiež sa pracuje na prenose niektorých optimalizácií, ktoré pripravili projekty Cinder a HotPy.
Naviac v rámci projektu nogil prebieha práca na experimentálnom režime zostavenia CPython bez globálnej zámky interpretera (GIL, Global Interpreter Lock), ktorá neumožňuje paralelné prístupy k zdieľaným objektom z rôznych vlákien, čo bráni paralelizácii operácií na viacjadrových systémoch. Ako iná možnosť riešenia problému s GIL sa vyvíja možnosť viazania samostatného GIL na každý interpreter vykonávaný v rámci procesu (v jednom procese môže prebiehať viacero interpreterov, ale efektívnosť ich paralelného vykonávania je obmedzená GIL).
Zdroj: opennet.ru
