Created
March 23, 2020 13:15
-
-
Save p7g/06db7ae3777e9902908e31c9a5dbbd4b to your computer and use it in GitHub Desktop.
BF interpreter python/pypy vs rust (based on kostya/benchmarks)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Benchmark brainf*ck program | |
>++[<+++++++++++++>-]<[[>+>+<<-]>[<+>-]++++++++ | |
[>++++++++<-]>.[-]<<>++++++++++[>++++++++++[>++ | |
++++++++[>++++++++++[>++++++++++[>++++++++++[>+ | |
+++++++++[-]<-]<-]<-]<-]<-]<-]<-]++++++++++. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
class Tape: | |
def __init__(self): | |
self.position = 0 | |
self.tape = [0] | |
def get(self): | |
return self.tape[self.position] | |
def inc(self, amount): | |
self.tape[self.position] += amount | |
def move(self, amount): | |
self.position += amount | |
while self.position >= len(self.tape): | |
self.tape.append(0) | |
def stringiterator(string): | |
for c in string: | |
yield c | |
class Op: | |
__slots__ = ('type', 'value', 'loop') | |
INC = 0 | |
MOVE = 1 | |
PRINT = 2 | |
LOOP = 3 | |
def __init__(self, typ, *, value=0, loop=()): | |
self.type = typ | |
self.value = value | |
self.loop = loop | |
def _parse(it): | |
instructions = [] | |
for c in it: | |
if c == '+': | |
instructions.append(Op(Op.INC, value=1)) | |
elif c == '-': | |
instructions.append(Op(Op.INC, value=-1)) | |
elif c == '>': | |
instructions.append(Op(Op.MOVE, value=1)) | |
elif c == '<': | |
instructions.append(Op(Op.MOVE, value=-1)) | |
elif c == '.': | |
instructions.append(Op(Op.PRINT)) | |
elif c == '[': | |
instructions.append(Op(Op.LOOP, loop=_parse(it))) | |
elif c == ']': | |
break | |
return instructions | |
def parse(text): | |
return _parse(stringiterator(text)) | |
def _run(code, tape): | |
for op in code: | |
if op.type == Op.INC: | |
tape.inc(op.value) | |
elif op.type == Op.MOVE: | |
tape.move(op.value) | |
elif op.type == Op.PRINT: | |
sys.stdout.write(chr(tape.get())) | |
sys.stdout.flush() | |
elif op.type == Op.LOOP: | |
while tape.get() != 0: | |
_run(op.loop, tape) | |
def run(code): | |
_run(code, Tape()) | |
if len(sys.argv) < 2: | |
sys.stderr.write('Expected filename arg\n') | |
exit(1) | |
with open(sys.argv[1], 'r') as f: | |
code = f.read() | |
run(parse(code)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::convert::TryInto; | |
use std::io::Write; | |
struct Tape { | |
position: i32, | |
tape: Vec<i32>, | |
} | |
impl Tape { | |
fn new() -> Self { | |
Self { | |
position: 0, | |
tape: vec![0], | |
} | |
} | |
fn get(&mut self) -> i32 { | |
self.tape[self.position as usize] | |
} | |
fn inc(&mut self, amount: i32) { | |
self.tape[self.position as usize] += amount; | |
} | |
fn mv(&mut self, amount: i32) { | |
self.position += amount; | |
while self.position as usize >= self.tape.len() { | |
self.tape.push(0); | |
} | |
} | |
} | |
enum Op { | |
Inc(i32), | |
Move(i32), | |
Print, | |
Loop(Vec<Op>), | |
} | |
fn _parse(chars: &mut std::str::Chars) -> Vec<Op> { | |
let mut instructions = Vec::new(); | |
while let Some(c) = chars.next() { | |
instructions.push(match c { | |
'+' => Op::Inc(1), | |
'-' => Op::Inc(-1), | |
'>' => Op::Move(1), | |
'<' => Op::Move(-1), | |
'.' => Op::Print, | |
'[' => Op::Loop(_parse(chars)), | |
']' => break, | |
_ => continue, | |
}); | |
} | |
instructions | |
} | |
fn parse(input: &str) -> Vec<Op> { | |
_parse(&mut input.chars()) | |
} | |
fn _run(code: &Vec<Op>, tape: &mut Tape) { | |
for op in code { | |
match op { | |
Op::Inc(n) => tape.inc(*n), | |
Op::Move(n) => tape.mv(*n), | |
Op::Print => { | |
print!("{}", (tape.get() as u32).try_into().unwrap_or('?')); | |
std::io::stdout().flush().unwrap(); | |
} | |
Op::Loop(insts) => { | |
while tape.get() != 0 { | |
_run(insts, tape); | |
} | |
} | |
} | |
} | |
} | |
fn run(code: &Vec<Op>) { | |
_run(code, &mut Tape::new()); | |
} | |
fn main() -> Result<(), Box<dyn std::error::Error>> { | |
let args = std::env::args().collect::<Vec<_>>(); | |
let filename = args.get(1).ok_or_else(|| "Expected filename arg")?; | |
let code = std::fs::read_to_string(filename)?; | |
run(&parse(&code)); | |
Ok(()) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A mandelbrot set fractal viewer in brainf*** written by Erik Bosman | |
+++++++++++++[->++>>>+++++>++>+<<<<<<]>>>>>++++++>--->>>>>>>>>>+++++++++++++++[[ | |
>>>>>>>>>]+[<<<<<<<<<]>>>>>>>>>-]+[>>>>>>>>[-]>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>[-]+ | |
<<<<<<<+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>>+>>>>>>>>>>>>>>>>>>>>>>>>>> | |
>+<<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+[>>>>>>[>>>>>>>[-]>>]<<<<<<<<<[<<<<<<<<<]>> | |
>>>>>[-]+<<<<<<++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<+++++++[-[->>> | |
>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>>+<<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[[-]>>>>>>[>>>>> | |
>>[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<+<<<+<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>>>>>> | |
[>>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->>>>>>>+<<+<<<+<<]>>>>>>>>]<<<<<<<<<[<<<<<<< | |
<<]>>>>>>>[-<<<<<<<+>>>>>>>]<<<<<<<[->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<<<<<<+>[<->-<<+>>]<[->+<]>>>>>>>>]<< | |
<<<<<[->>>>>>>+<<<<<<<]<+<<<<<<<<<]>+++++[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>> | |
+>>>>>>>>>>>>>>>>>>>>>>>>>>>+<<<<<<[<<<<<<<<<]>>>>>>>>>[>>>>>>[-<<<<<<->>>>>>]+< | |
<<<<<[->>>>>>->>[-<<<<<<<<+>>>>>>>>]<<<<<<<<[->>>>>>>>+<<<<<<<<<<<<<<<<<[<<<<<<< | |
<<]>>>>[-]+>>>>>[>>>>>>>>>]>+<]]+>>>>>>>>[-<<<<<<<<->>>>>>>>]+<<<<<<<<[->>>>>>>> | |
-<<[-<<<<<<+>>>>>>]<<<<<<[->>>>>>+<<<<<<<<<<<<<<<[<<<<<<<<<]>>>[-]+>>>>>>[>>>>>> | |
>>>]>[-]+<]]+>[-<[>>>>>>>>>]<<<<<<<<]>>>>>>>>]<<<<<<<<<[<<<<<<<<<]>>>>[-]<<<++++ | |
+[-[->>>>>>>>>+<<<<<<<<<]>>>>>>>>>]>>>>>->>>>>>>>>>>>>>>>>>>>>>>>>>>-<<<<<<[<<<< | |
<<<<<]]>>>] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment