Optimizing Brainfuck interpreter in the C preprocessor
github.com
github.com
https://github.com/erikdubbelboer/brainfuck-jit/blob/master/...
> loops like [-], [>] and [<] could even be completely reduced to a single operation.
This has got me wondering if it would make sense to pre-process the BF programs I've been using in genetic programming experiments. Loops are the #1 thing that slow down the search. But, I don't know that this optimization pass would be paid for in the typical case - at least not until the average complexity of the population reaches a certain point.
If so, I probably need to spend a lot more time in this rabbit hole.
``` cargo install --git https://github.com/john-h-k/rustfuck
rustfuck <source> --lir # or --jit if you are on arm64 and don't need to read from stdin ```
As for optimizations, I figure evolution-designed languages might come up with things that are hard to pattern match for more complex operations.
I'm trying to determine if a more symbolic approach may lend itself to broader generalization capabilities in lieu of massive amounts of training data. I am also trying to determine if dramatically simplified, CPU-only architectures could be feasible. I.e., ~8 interpreted instructions combined with clever search techniques (tournament selection & friends).
I don't have anything public yet. I am debating going wide open for better collaboration with others.
> I figure evolution-designed languages might come up with things that are hard to pattern match for more complex operations.
I think I agree with this - once you hit a certain level of complexity things would get really hard to anticipate. The chances you would hit good patterns would probably drop over time as the model improves.
I've been looking at an adjacent idea wherein a meta program is responsible for authoring the actual task program each time, but I haven't found traction here yet. Adding a 2nd layer really slows down the search. And, the fitness function for the meta program is a proxy at best unless you have a LOT of free time to critique random program sources.