6

Pyjion - A Python JIT Compiler

 2 years ago
source link: https://www.trypyjion.com/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Installation

After following the installation steps, pyjion is a python module that you can import a Python 3.10 environment:
python -m pip install pyjion

After importing pyjion, enable the JIT using the enable function:

import pyjion; pyjion.enable()
Any Python code you define or import after enabling pyjion will be JIT compiled. You don't need to execute functions in any special API, it's completely transparent:

>>> def half(x):
...    return x/2
>>> half(2)
1.0
                
You can also execute Pyjion against any script or module:
pyjion my_script.py
Or, for an existing Python module:
pyjion -m calendar

That's it! For the full API, checkout the documentation.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK