Open Zomis opened 9 years ago
By having Groovy parse the script only once, instead of once every time it is runned, full analysis of FizzBuzz now takes 2.3 seconds
A problem with keeping track of [
and ]
is that BrainFCommand.WHILE
and BrainFCommand.END_WHILE
are referenced a lot in the source. To jump faster one way would be to keep track of the possible destination indexes within the command, but this is just not possible with the enum. Another alternative would be to store the information some other place within the BrainfuckRunner
or BrainfuckCode
, but I am not sure that is a good option.
Take a look at https://github.com/rdebath/Brainfuck for a fast interpreter.
As more and more features are added to the analysis, it takes longer and longer time to run. The FizzBuzz analysis alone takes about 17 seconds on my reasonably-fast computer. Running without analysing takes 15.6 seconds Running without groovy code enabled takes 0.7 seconds
Possible ways to improve performance:
[
and]
are grouped together to be able to jump to the other one immediately without requiring a code-search each time