Brainfuck JIT interpreter in Python
Project description
What's this? A fast brainfuck JIT interpreter!
How to use?
To use it, you can either write your code like this:
from jitbf import bf2jit
code='<code>'
jit=bf2jit(code)
jit()
, or use the jitbf command.
You have to install tha package 'llvmlite' before using this package.
How fast is it?
I compared this JIT interpreter with the Quick Dirty Interpreter In C. The brainfuck code used in the test is mandel.b. The operating system used in the test is Windows 10 64 bit.
Interpreter: jitbf 1.0.0 Time to run: 3.5764139s
Interpreter: Quick Dirty Interpreter In C Time to run: 8.3990561s
The
How does it work?
The package is based on LLVM, it first translates brainfuck into LLVM IR code, then uses llvmlite to compile and run it.
How will you improve it in the future?
I will improve it by making the LLVM IR code it translates smaller, and runs faster.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file jitbf-1.0.0.tar.gz
.
File metadata
- Download URL: jitbf-1.0.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c95b309330edf36ae3f7dbb05ad10de153f9e82a2a6a0758ac581edc3b73d524 |
|
MD5 | 6dd353744d44f4807e7516583534d79c |
|
BLAKE2b-256 | 1a411048e630143a772cd21875c53f1ecd5cceea2e4fe69ec7cea0681e07e5c2 |
File details
Details for the file jitbf-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: jitbf-1.0.0-py3-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.7.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 36515bdcd76cb40b9292a4a93a46cc88da08111b25af42d5808a9357e8818efe |
|
MD5 | 2e8a272ffd7a9e6ef09b2dae00476fa3 |
|
BLAKE2b-256 | b8a0e4a70267e3475730a959996a53df8f5445ba48422e1d5139dee7ee10e5c3 |