brainfuck speed test

From Esolang
Jump to navigation Jump to search

The following is a speed test for many brainfuck interpreters and compilers.

Each interepreter runs dbfi which runs this program:



Caption text
Interpreter Language Author Time (seconds)
qdb C Daniel B. Cristofani 0.3502939
brainfuck Python interpreter Python User:None1 81.7679009
jitbf 1.0.0 Python User:None1 0.1233671
jitbf 1.0.1 Python User:None1 0.1135326
bffsree C Sree Kotay 0.0539569
brainfuck-rs Rust GitHub user Jomy10 5.1999124
bfi Python GitHub user eriknyquist 14.8676839
brainfuck C++ interpreter C++ User:None1 0.4708531
sbi C Daniel B. Cristofani 0.4961111
bf-rs interpreter Rust User:Pro465 0.2766346
bf-rs compiler Rust User:Pro465 0.6421914
BrainFExec 1.0.0 C# User:None1 0.2496979
BrainFExec 1.0.1 C# User:None1 0.1609425
brainfuck JavaScript interpreter JavaScript User:None1 4.9762423

Speed chart

The following is a bar graph showing the time consumption of every brainfuck interpreter:

Brainfuck speed chart


bffsree>jitbf>BrainFExec>bf-rs interpreter>qdb>brainfuck C++ interpreter>sbi>bf-rs compiler>brainfuck JavaScript interpreter>brainfuck-rs>bfi>brainfuck Python interpreter

bffsree is obviously the fastest, my jitbf also did this quite quickly, but since dbfi is very short, the optimization in jitbf 1.0.1 does not change the speed much (moreover, in this test, jitbf spends more than half the time to compile LLVM IR than to JIT interpret it), making it just a tiny bit faster than jitbf 1.0.0. brainfuck-rs, the brainfuck interpreter in Rust is also very slow, but bf-rs's compiler is faster, and bf-rs's interpreter is even faster. And finally, brainfuck Python interpreter is no match for the others.

Note: The speed of a brainfuck interpreter is dependent on the computer, and also Windows caches in the second time I run, so the first run might be inaccurate.

Request for other interpreters

If you want me to test more interpreters, you can post it at the talk page just like User:Pro465 did, but remember that your interpreter should run correctly under Windows, or I am good enough at the programming language to modify it to let it run correctly under Windows.