Pyjion - A drop-in JIT Compiler for Python 3.10

https://www.trypyjion.com/

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

How do this compare to …

Numba is a JIT compiler for “array-oriented and math-heavy Python code”. This means that Numba is focused on scientific computing while Pyjion tries to optimize all Python code. Numba also only supports LLVM.

IronPython is an implementation of Python that is implemented using .NET. While IronPython tries to be usable from within .NET, Pyjion does not have a compatibility story with .NET. This also means IronPython cannot use C extension modules while Pyjion can.


看 fork 是在微软的老项目上继续开发。

emmm,看起来是编译到dotnet上了,然后再到native。