https://www.trypyjion.com/ Toggle navigation Menu * Overview * Install * Documentation * Benchmarks * Try it Out * Source Code [pyjion_logo] --------------------------------------------------------------------- A drop-in JIT Compiler for Python 3.10 Download Pyjion is a drop-in JIT Compiler for Python 3.10. It can be pip installed into a CPython 3.10 installation on Linux, Mac OS X, or Windows. Pyjion can make your Python code execute faster without any code changes. * Profile Guided JIT Compiler * Native 64-bit float and integer support * Small, fast compiler * Windows, macOS and Linux * Intel and ARM CPU support * Builtin IL and ASM disassembler * Support for native debugging and profiling tools Installation Pyjion requires: * CPython 3.10 * .NET 6 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. Benchmarks Data is on a Linux X86_64 machine. Benchmark scripts are in the Pyjion source repo. Some benchmarks have a slow max/mean value because the time includes JIT-compiling large libraries like Pandas. Technology Pyjion is a JIT compiler. It compiles native CPython bytecode into machine code. Without Pyjion, CPython uses a master evaluation loop (called the frame evaluation loop) to iterate over opcodes The Pyjion compiler has 3 main stages: 1. Build a "stack table" of the abstract types at each opcode position 2. Compile CPython opcodes into IL (ECMA335 CIL) instructions 3. Emit the CIL opcodes into the .NET EE compiler to convert to native machine code/assembly [technical-]