r/brainfuck • • 8h ago

What if a computer used bf for it's assembly language

5 Upvotes

I’m wondering, it would probably be hard to implement a cpu designed for brainfuck,

but how do you think it would match in terms of speed?

like bf could run directly on your ram with an actual pointer, and bf instructions are really cheap computational wise.

so do yall think it’d be faster, slower, or similar to normal assembly


r/brainfuck • • 19h ago

Compiler optimization techniques?

2 Upvotes

I finished writing a (really crude) brainfuck JIT not too long ago and while I'm pretty pleased with its speed, I'm still thinking of ways I could make it faster. I already thought of reducing chains of unary arithmetic instructions like +, -, <, and > into a single instruction, and I'm thinking of reducing [-] into something along the lines of tape[datapointer]=0 because it seems to be a fairly common construct in the programs I've found on the internet.

What else can I do to make my interpreter faster? Are there any low-hanging fruits left to pick?