Closed jokey2k closed 11 years ago
Hi @jokey2k, yes, it's unnecessarily complex and slow! The idea was to make it "elegant", not fast, then I added other versions to compare them.
Anyway, I added a second version similar to that example, and one which is also similar but slightly modified so it can be translated with RPython. I added a new table at the end comparing all versions. What's surprising is that the RPython version of the interpreter is faster than the C version, even compiled with optimizations! Only the brainfuck programs translated to C and then compiled run faster than the RPython interpreter.
Thanks for your suggestions!
That's the big pro when you compile something with a tracing jit. If there are loops, things are heavily speeded up ;) You are right, that otherwise some handcrafted this might be faster. but then concerning time of development and ease of maintenance gives most credit ;)
The python version you have is overly complex and slow as hell ;)
Better use this one: https://bitbucket.org/brownan/pypy-tutorial/src/tip/example1.py
Might also want to include PyPy timing results in your output as well as a translated version with RPython.