Fast Python JIT compiler using LLVM ORC
Project description
JustJIT
Fast Python JIT compiler using LLVM ORC for aggressive runtime optimization.
Overview
JustJIT is a high-performance Just-In-Time compiler for Python that leverages LLVM's ORC JIT infrastructure to compile Python bytecode to native machine code at runtime. It analyzes Python function bytecode and generates optimized LLVM IR, enabling significant performance improvements for compute-intensive workloads.
Features
- Python bytecode to LLVM IR compilation
- LLVM optimization levels 0-3 with aggressive optimizations
- Native callable generation via nanobind
- Support for Python 3.8-3.13
- Cross-platform support (Windows, Linux, macOS)
- Zero-overhead C++ integration
Installation
Prerequisites
- Python 3.8 or higher
- CMake 3.20 or higher
- LLVM 22.0.0 or compatible version
- C++17 compatible compiler
- nanobind 2.0.0 or higher
Build from Source
git clone https://github.com/magi8101/justjit.git
cd justjit
pip install -e .
LLVM Configuration
Set the LLVM installation path during build:
cmake -DLLVM_DIR=/path/to/llvm/build/lib/cmake/llvm ..
Usage
Basic Usage
from justjit import jit
@jit
def add(a, b):
return a + b
result = add(5, 3)
Custom Optimization Levels
from justjit import jit
@jit(opt_level=3, vectorize=True)
def compute(x, y):
result = 0
for i in range(1000):
result += x * y
return result
Decorator Options
opt_level: LLVM optimization level (0-3, default: 3)vectorize: Enable loop vectorization (default: True)inline: Enable function inlining (default: True)parallel: Enable parallelization (default: False)lazy: Delay compilation until first call (default: False)
Architecture
Core Components
- JIT Core: LLVM ORC JIT engine wrapper with optimization pipeline
- Bytecode Compiler: Python bytecode to LLVM IR translator
- Python Bindings: nanobind-based Python interface
- Optimization Pipeline: Multi-pass LLVM optimization passes
Supported Python Operations
- Arithmetic operations (add, subtract, multiply, divide, modulo)
- Comparison operations
- Variable loading and storing
- Function calls
- List and tuple operations
- Attribute access
- Control flow (jumps, loops)
Development
Project Structure
justjit/
├── src/
│ ├── jit_core.cpp # Core JIT compilation engine
│ ├── jit_core.h # JIT engine header
│ ├── bindings.cpp # Python bindings
│ └── justjit/
│ └── __init__.py # Python package interface
├── docs/
│ └── OPCODES_REFERENCE.md
├── CMakeLists.txt # Build configuration
├── pyproject.toml # Python package metadata
└── ERRORS.md # Build troubleshooting guide
Build System
Uses scikit-build-core for building the C++ extension with CMake integration.
Testing
python -m pytest tests/
Current Status
Development Status: Alpha
The project is under active development. See ERRORS.md for current build status and known issues.
Contributing
Contributions are welcome. Please ensure:
- Code follows C++17 and Python 3.8+ standards
- All tests pass before submitting PRs
- Documentation is updated for new features
- Cross-platform compatibility is maintained
License
MIT License
Authors
JustJIT Contributors
Links
Technical Details
LLVM Integration
JustJIT uses LLVM ORC v2 JIT API for dynamic compilation:
- ThreadSafeContext for concurrent compilation
- LLJIT builder for JIT stack setup
- Symbol resolution via ExecutionSession
- Native target initialization
Python C API Integration
Direct integration with CPython internals:
- PyObject manipulation via LLVM function calls
- Reference counting management
- Native type conversions
- Exception handling
Performance Characteristics
- First call: Compilation overhead + execution
- Subsequent calls: Native execution speed
- Optimization level 3: Maximum performance, higher compile time
- Optimization level 0: Fastest compilation, basic optimizations
Requirements
Runtime Dependencies
- numpy >= 1.20.0
Build Dependencies
- scikit-build-core >= 0.4.3
- nanobind >= 2.0.0
- LLVM development libraries
- zlib (platform-specific)
Platform-Specific
Windows:
- Visual Studio 2022 Build Tools or equivalent
- Windows SDK
Linux:
- GCC 7+ or Clang 10+
- Development headers for Python
macOS:
- Xcode Command Line Tools
- macOS 10.14 or higher
Troubleshooting
See ERRORS.md for detailed build error documentation and solutions.
Common Issues
LLVM not found:
cmake -DLLVM_DIR=/path/to/llvm/lib/cmake/llvm ..
Python version mismatch: Ensure Python development headers match runtime version.
zlib missing: Install zlib development package for your platform.
Roadmap
- Complete bytecode opcode coverage
- Advanced optimization passes
- Multi-threading support
- Ahead-of-time compilation mode
- Profiling and debugging tools
- Extended type inference
- GPU offloading capabilities
Acknowledgments
Built with:
- LLVM Project
- Python3
- nanobind
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file justjit-0.1.0.tar.gz.
File metadata
- Download URL: justjit-0.1.0.tar.gz
- Upload date:
- Size: 757.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d471b412b55422925d126e62276d6f0b59dd6faa77b02bbd761351f74f74be28
|
|
| MD5 |
0813c6a7ee58a9034194445b2a4a4f18
|
|
| BLAKE2b-256 |
942d5ac1e0f551ce482a6dc73270852bb4f55e6003948085a69c0b0a00b66284
|
File details
Details for the file justjit-0.1.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: justjit-0.1.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 14.3 MB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b6ac92d84f951756a078fa2ca04e00ad550ed19a2fddc5af99189443ca3cfca2
|
|
| MD5 |
97c9785bc73d95f20aebf6ca9af33d6b
|
|
| BLAKE2b-256 |
9a411099133c2ec95b7071fc9546c77bc149a400d27c928460f8023639c0a059
|
File details
Details for the file justjit-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp313-cp313-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 27.4 MB
- Tags: CPython 3.13, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
63236a6689261a412a717a5073a5a572bd10a77b58db01b9455a5266792f8dc8
|
|
| MD5 |
8b075c37cbb664e8196dd0356acd775d
|
|
| BLAKE2b-256 |
ac3fed3d62bf6b701b06cb208819bce7fb68b23f5d02cf71a7e8989e11e9445c
|
File details
Details for the file justjit-0.1.0-cp313-cp313-macosx_11_0_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp313-cp313-macosx_11_0_x86_64.whl
- Upload date:
- Size: 19.2 MB
- Tags: CPython 3.13, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
73f11534914feb35074b7af1e6b0e580c2aed2b02bbaa1541e0a38c13648c62b
|
|
| MD5 |
2b97a2fe1b12be5f1a65c432473d2480
|
|
| BLAKE2b-256 |
c4ff109d68f3e705fb0b2f58acc39e9d1eb4908547bf8344c2228d774687d5e8
|
File details
Details for the file justjit-0.1.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: justjit-0.1.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 17.2 MB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9ac7f83f0d9fd24f043a26b1e281772ca63da7efffc4115a4b0383b36214f51
|
|
| MD5 |
8429b07ced73946d85334e3d01ebc998
|
|
| BLAKE2b-256 |
18a1a602c2e6bb3949cfd42b7bd190b2eb769877641f917ec3cf593255703d9a
|
File details
Details for the file justjit-0.1.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: justjit-0.1.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 14.3 MB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0adff8417fb8b492a77013bbd31e56a092babbf2affa65d89045ad5ce5344742
|
|
| MD5 |
aad805a2a04c23dc7c9eea54028db89a
|
|
| BLAKE2b-256 |
3b0de362ca4f04e411e9c7109d0f2bc147fa352d637565a6d1ec432ec0965599
|
File details
Details for the file justjit-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp312-cp312-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 27.4 MB
- Tags: CPython 3.12, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d2f329e9acb46ee853a72377f211589751c13d62a926c1b8b1753c1dc0465cc3
|
|
| MD5 |
644f8c71bb76dd3599c7a4afd2635895
|
|
| BLAKE2b-256 |
d21c5cc5ad3d35534ae5c0e9b82f89cc6e422e3f0d246778c6b89074578ccfc2
|
File details
Details for the file justjit-0.1.0-cp312-cp312-macosx_11_0_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp312-cp312-macosx_11_0_x86_64.whl
- Upload date:
- Size: 19.2 MB
- Tags: CPython 3.12, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b69e40e90e491e0be9a4b5c8496145bc2a4a20326c89020595f5d4661f86b05
|
|
| MD5 |
d8aab0716a52984c696b45c95df50a4b
|
|
| BLAKE2b-256 |
02d44093767a6a71245bab78cdd6a65da160a18dd526f4e62aad834b18ee982d
|
File details
Details for the file justjit-0.1.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: justjit-0.1.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 17.2 MB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10faa9ae7de089d6caa37ad71f84f51dc7dc1e422caa5d5bc39212246ac3f4d0
|
|
| MD5 |
b47db632f3eb50f40c19e77583fab0b9
|
|
| BLAKE2b-256 |
a79d37d9571d1d6d182e642831497ba32b49a9ada87fa314576c587eafaa6f83
|
File details
Details for the file justjit-0.1.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: justjit-0.1.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 14.3 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c22841547d9cfc9c8b9927e5d7d931e305bee95fb9937d1db6a20bce9b6ef85
|
|
| MD5 |
63495dc5e73efe6c0885d2c433c1830b
|
|
| BLAKE2b-256 |
24dee968a0dfc53ed67a33dbddb44484a2b1268186cc558486b9a13259b763a5
|
File details
Details for the file justjit-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp311-cp311-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 27.4 MB
- Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7ff5a399892fd771b87263730afc04b312830de4e11977ab28cca61cf9690e4
|
|
| MD5 |
fe2ef0c20158204897c3a1a3dd1515e4
|
|
| BLAKE2b-256 |
749e038ec412ded5244d857ac35bac7dd0ac72f70194fa94c61433e94668d651
|
File details
Details for the file justjit-0.1.0-cp311-cp311-macosx_11_0_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp311-cp311-macosx_11_0_x86_64.whl
- Upload date:
- Size: 19.2 MB
- Tags: CPython 3.11, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe01818b891fb17dd264fab29cc79693460d167bca9640e5b2a43d5712a925fb
|
|
| MD5 |
cd0ad8350a4d0b3d3e21b5686482adc4
|
|
| BLAKE2b-256 |
2c899740d467dc361fb02b433ed76736155157f7a71f32054ebe817fad8b726d
|
File details
Details for the file justjit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: justjit-0.1.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 17.2 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3ce30546febd27302cea3a07547bcaf91271e1e0935c4e0b810eb04fc33c5d91
|
|
| MD5 |
9a169dbf849e540b1c580003540dabf8
|
|
| BLAKE2b-256 |
2decfba2ee1d39a200e866b707615e8a7237367d37e47c7947e0131389cfe686
|
File details
Details for the file justjit-0.1.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: justjit-0.1.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 14.3 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69e6064920fd682a9c7c6a80a64c8b74c62230655b34ef7ab8cc54c7d8353a2d
|
|
| MD5 |
198417a0841042f16447bc0d208fffef
|
|
| BLAKE2b-256 |
6bdf04110b9bb0833d0bc38b8846c7dfcbfe99c409b228ea2fdd9867dbff3ec2
|
File details
Details for the file justjit-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp310-cp310-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 27.4 MB
- Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ed1c2aef437f39a06e0a9e839e6b88b0ca5e89d2bf814151cc4c8c7d32aaa33b
|
|
| MD5 |
9115327d35b19bcd8d5886540baa9efa
|
|
| BLAKE2b-256 |
6fee3ecb7920f73cd82133a2042867dc6542934dbaddf468bf9ea23c2cd514dc
|
File details
Details for the file justjit-0.1.0-cp310-cp310-macosx_11_0_x86_64.whl.
File metadata
- Download URL: justjit-0.1.0-cp310-cp310-macosx_11_0_x86_64.whl
- Upload date:
- Size: 19.2 MB
- Tags: CPython 3.10, macOS 11.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b2556ecb272b1e4ac6cd5c22e8fdff8fd37f1c6c2aff778080076ef96b3ce639
|
|
| MD5 |
8de870f4aa644c5a06072796a27c66a3
|
|
| BLAKE2b-256 |
830dadc2351f68cbe680cae3b1e0444c725826bae1f7c4287aa4a627ed8e7f0a
|
File details
Details for the file justjit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: justjit-0.1.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 17.2 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17cbe55fd5fc45f44190d1484b838d5805a77819ad75fb9b3d07ae684e751868
|
|
| MD5 |
8a430cb24c42eb3e9b0c5473a376535b
|
|
| BLAKE2b-256 |
6b55d2479d63b6cdb1b53b9748d1b6c193a8510fc2e1b78b1c3bcd70af607470
|