Brainfuck interpreter
Interpreter-inside-interpreter: a host language interpreting a Brainfuck program. The purest measurement of dispatch cost we have.
Compile time · median (cold)
Full statistics
| Runner | N | Compile | Runtime | P95 | Stddev | RSS | vs piko | Status |
|---|---|---|---|---|---|---|---|---|
| Native Gocompiled | 10 | 183 ms | 28.3 µs | 29.3 µs | 729 ns | 68 MiB | 185× | OK |
| Piko interpbytecode VM | 10 | 993 µs | 294 µs | 336 µs | 18.6 µs | 91 MiB | 1.00× | OK |
| CPython 3.13bytecode VM | 10 | 324 µs | 388 µs | 406 µs | 12.9 µs | n/a | 0.33× | OK |
| PyPy 7.3tracing JIT | 10 | 277 µs | 3.06 ms | 3.15 ms | 60.7 µs | n/a | 0.28× | OK |
| tengobytecode VM | 10 | 292 µs | 17.7 ms | 18.3 ms | 241 µs | 297 MiB | 0.29× | OK |
| scriggobytecode VM | 10 | 274 µs | 506 µs | 852 µs | 106 µs | 74 MiB | 0.28× | OK |
| mvmbytecode VM | 10 | 327 µs | 2.39 ms | 3.62 ms | 378 µs | 62 MiB | 0.33× | OK |
| yaegiAST walker | 10 | 404 µs | 1.72 ms | 2.00 ms | 247 µs | 62 MiB | 0.41× | OK |
Workload & symmetry rules
Workload
Host language interprets a small Brainfuck program. Every BF instruction is one full dispatch through the host's interpreter loop. Output is a 32-bit fold over the emitted bytes.
Symmetry rules
- No third-party BF library, no eval-based execution, no threaded-code tricks.
- Bracket jump table built once at start.
- Switch / if-elif dispatch on opcode character.
Why this is the purest dispatch benchmark
Every BF instruction is one host-language switch + one memory access. A 2× faster dispatch loop is a 2× faster wall time. The workload has no library escape hatch.
Source code
piko / Go
piko_source.gonative Go
native_main.goCPython / PyPy
cpython.pytengo
script.tengo