Skip to main content

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: jitbf 1.0.1 Time to run: 3.2445391s

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. (already done in this version)

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

jitbf-1.0.1.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

jitbf-1.0.1-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file jitbf-1.0.1.tar.gz.

File metadata

  • Download URL: jitbf-1.0.1.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.0

File hashes

Hashes for jitbf-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ed225366e133b04280af284699cd6b31846708b9a2ae3a1a0427705b9311cff9
MD5 77b769d077c4263fd58b8cec999354e3
BLAKE2b-256 ebd4a7cb8482c1dbf02794eb4d347027cfa440f01f29265744b5fe34fc6e0e41

See more details on using hashes here.

File details

Details for the file jitbf-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: jitbf-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.0

File hashes

Hashes for jitbf-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 854405e4071bbb4d72281410f12cfbbaf5aa19eb309926f8b30075e1a0725ad8
MD5 5b6daea7716f8dff7da0f29e4ce131ca
BLAKE2b-256 1a6ccc4857d49c4d976ad415bc45f43ed665a3fa2ad51dcea53ef8fac77137b6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page