We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.
brainfuck speed test
The following is a speed test for many brainfuck interpreters and compilers.
Each interpreter runs dbfi which runs this program:
+++++++++++++++++[>+++++++++++++++<-]>[>+++++++++++++++++[>+++++++++++++++<-]<-]>>>++++++++[<++++++>-]<.
Result
Note: A long time has passed since the last retest and the author's computer became slower, so this test might be slower than the previous ones, which you can find in the page history.
Note: Since this test, each interpreter will be tested 3 times, and the final result is the average.
All programs are compiled/interpreted with the most commonly used optimization, All C/C++ programs are compiled using MinGW.
| Interpreter | Language | Author | Time (seconds) | Compilation argument | Execution argument |
|---|---|---|---|---|---|
| qdb | C | Daniel B. Cristofani | 0.3981146 | gcc qdb.c -o qdb.exe -O2 | type program.b|qdb dbfi.b |
| brainfuck Python interpreter | Python | User:None1 | 82.9338825 | no compilation | type program.b|python mybf.py dbfi.b |
| jitbf 1.0.0 | Python | User:None1 | 0.2975531 | no compilation | type program.b|python -c "import jitbf100;jitbf100.bf2jit(open('dbfi.b').read())()" |
| jitbf 1.0.1 | Python | User:None1 | 0.2664532 | no compilation | type program.b|python -c "import jitbf101;jitbf101.bf2jit(open('dbfi.b').read())()" |
| bffsree | C | Sree Kotay | 0.0657208 | gcc bffsree.c -o bffsree_gcc.exe -O2 | type program.b|.\bffsree_gcc dbfi.b |
| brainfuck-rs | Rust | GitHub user Jomy10 | 5.1666747 | cargo b --release | type program.b|.\brainfuck-rs dbfi.b |
| bfi | Python | GitHub user eriknyquist | 17.6087104 | no compilation | type program.b | python -c "from bfi import interpret;interpret(open('dbfi.b').read())" |
| brainfuck C++ interpreter | C++ | User:None1 | 0.261292 | gcc brainfuck.cpp -o brainfuck.exe -O2 | type program.b | .\brainfuck dbfi.b |
| sbi | C | Daniel B. Cristofani | 0.5229518 | gcc sbi.c -o sbi.exe -O2 | type program.b | .\sbi dbfi.b |
| bf-rs interpreter | Rust | User:Pro465 | 0.2664532 | rustc -C opt-level=3 main.rs | type program.b | .\bfrs-i dbfi.b |
| bf-rs compiler | Rust | User:Pro465 | 0.6754998 | rustc -C opt-level=3 main.rs | type program.b | .\bfrs-c dbfi.b |
| BrainFExec 1.0.0 | C# | User:None1 | 0.2670609 | .\brainfexec100 dbfi.b | type program.b | .\dbfi |
| BrainFExec 1.0.1 | C# | User:None1 | 0.2676928 | .\brainfexec101 dbfi.b -o | type program.b | .\dbfi |
| brainfuck JavaScript interpreter | JavaScript | User:None1 | 5.3673597 | no compilation | node brainfuck.js |
| esco 0.512 | C++ | Zasenko Sergey | 1.4343285 | no compilation | type program.b|.\esco -t bf dbfi.b |
| bfrun 1.2 | Java | Unknown | 0.6840074 | no compilation | type program.b|java -jar bfrun.jar -O3 dbfi.b |
| El Brainfuck | JavaScript | copy | 0.107 | no compilation | Executed online |
The PowerShell Measure-Command cmdlet was used to calculate execution time.
Speed chart
The following are bar graphs showing the speed of every brainfuck interpreter:
Conclusion
bffsree>El Brainfuck>brainfuck C++ interpreter>jitbf 1.0.1>bf-rs interpreter>BrainFExec 1.0.0>BrainFExec 1.0.1>jitbf 1.0.0>qdb>sbi>bf-rs compiler>bfrun 1.2>esco 0.512>brainfuck-rs>brainfuck JavaScript interpreter>bfi>brainfuck Python interpreter
bffsree is obviously the fastest. El Brainfuck runs surprisingly fast, maybe because it translates brainfuck into JS first. 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.


