a brainf*ck JIT
C C++ Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bench
libjit
src
.gitignore
Makefile
README.md

README.md

Brainf*ck JIT

A JIT compiler for Brainf*ck programs made using LibJIT.

It does very naive optimizations right now, like folding of multiple same instructions into one.

Blog post about the same is here.

Build Instructions

  • Download and build LibJIT. I have a compiled version for my own system (Linux 32-bit) in the repo itself, you can use that.
  • Update the LIBJIT_PATH variable in the Makefile if you are using your own LibJIT binaries.
  • Run make.

Benchmarks

The bench folder has a bench.sh script that tests the Mandelbrot program with different implementations. The results on my system are:

Implementation                      Time
----------------------------------------
Mandelbrot (C Unoptimized)       22.343s
Mandelbrot (C Optimized)          1.241s
Mandelbrot (BF Interpreter)       8.304s
Mandelbrot (BF JIT)               1.609s

The unoptimized JIT is 5x faster than the optimizing interpreter and almost at par with the optimized C code.