/bf-rs

Fast Brainfuck interpreter in Rust.

Primary LanguageRustApache License 2.0Apache-2.0

bf-rs

Actions Status

Fast Brainfuck interpreter written in Rust.

Prerequisites

  • Rust toolchain (1.39.0 or greater)
  • LLVM 8.0

Installation

cargo install --git https://github.com/3c1u/bf-rs.git

Benchmarks

This table shows the time taken to run the programs on interpreters. These results were measured on a MacBook Pro (Late 2016, i7-6700HQ).

bf-rs (v1.0.1) bf-rs (opt) bfc bf02
mandelbrot 3.56 sec 3.22 sec 5.26 sec 9.82 sec
hanoi 0.44 sec 1.79 sec 0.38 sec 1.06 sec
long 2.07 sec 0.87 sec 2.51 sec 7.30 sec
bench 0.16 sec 0.10 sec 0.41 sec 0.58 sec
factor 0.83 sec 0.67 sec 1.19 sec 4.00 sec

About example programs

These are some programs that I have found online. I did not write any of them.

  • bench.bf Found on here. Shows the alphabets in a reverse order.
  • mandelbrot.bf Found on here. Prints a beautiful Mandelbrot set.
  • hanoi.bf Found on here. Solves the Tower of Hanoi problem.
  • factor.bf Obtained from here.
  • long.bf Obtained from bfc repositiory.
  • oobrain.bf Obtained from here. Used for testing proper u8 handling.

License

This program is lisensed under the Apache License 2.0 or MIT License.