API Reference¶
Command-line¶
You can run pyjion
as a standalone command-line program, similar to how you would use python
to run scripts and modules.
usage: pyjion [-m MODULE] | [script]
Python JIT Compiler
positional arguments:
script script file
optional arguments:
-m MODULE Execute module
You can enable PGC by setting the PYJION_PGC
environment variable to 1.
You can override the optimization level (default 1) by setting the PYJION_LEVEL
environment variable.
Core module¶
- pyjion.enable()¶
Enable the JIT
- pyjion.disable()¶
Disable the JIT
- pyjion.config(pgc: Optional[bool], level: Optional[int], debug: Optional[bool], graph: Optional[bool], threshold: Optional[int]) Dict[str, Any]: ¶
Get the configuration of Pyjion and change any of the settings.
- pyjion.il(f)¶
Return the ECMA CIL bytecode as a bytearray
- pyjion.native(f)¶
Return the compiled machine-code as a bytearray
- pyjion.offsets(f: Callable) tuple[tuple[int, int, int]]: ¶
Get sequence points for a compiled function (used by the Disassembler)
- pyjion.symbols(f: Callable) Dict[int, str]: ¶
Get method symbol table (used by the Disassembler).
Disassembly module¶
- pyjion.dis.dis(f, include_offsets=False, print_pc=True)¶
Print the ECMA CIL bytecode in a disassembly table. Set
include_offsets=True
to print the Python opcodes inline with the IL.
- pyjion.dis.dis_native(f, include_offsets=False, print_pc=True)¶
Print the x86_64 assembly instructions in a disassembly table (requires distorm3 and rich) Set
include_offsets=True
to print the Python opcodes inline with the assembly.
WSGI middleware¶
- class pyjion.wsgi.PyjionWsgiMiddleware(application)¶
Provides a WSGI middleware interface that enables the JIT for requests