cesquivias/mumbler — pull request #3 by Grashalm (2014-12-18 16:12:37+00:00)
Title: Changes for performance

Truffle needs warmup in order to optimize properly. So to measure peak performance you need to warmup the benchmark first. You can do this simply by adding a few calls to fib(30) before you actually measure. If you don't do that you are just measuring Truffle interpreter and not the Truffle JIT performance.

I reran your benchmark using Simple Language using just one call to fib(30) and in fact I got a slow result as expected:
computation time: 849835μs

Now I added warmup ("fib(30);fib(30);fib(30);fib(30);fib(30);fib(30);") as the first line of the benchmark and I got the result:
computation time: 46832μs

That's a 18x speed up for SL although fibonacci is not a benchmark where we are particularly good as it measures mostly call performance. I would strongly suggest to add other benchmarks to your suite in order to perform a proper evaluation.

Doing the same your mumbler implementation I get:
('computation-time: 1903ms) without warmup
and
('computation-time: 1058ms) with warmup.

That is not a good result. So I took a deeper dive into your interpreter. It turns out that your variable lookup is too complex. I did a very basic implementation of a speculative variable lookup which helps a lot. Together with a few other changes I could improve performance to:
('computation-time: 255ms)

Of course this is just the beginning. Target performance should be Simple Language with 47ms.

If you have further questions. Please don't hesitate to contact me or to write to graal-dev@openjdk.java.net mailing list.