Profiling a Truffle language

Chris Seaton chris.seaton at
Sun Jul 31 11:58:25 UTC 2016

> On 31 Jul 2016, at 10:45, Gerard Krol <gerard at> wrote:
> Hi,
> The benchmark "Fannkuch" runs correctly using Cover[1], but it is about 10x
> as slow as I'd like it to be (and much slower than "Mandelbrot"). I've
> taken a look at the disassembly and there are a lot of calls to java
> functions left. It's a bit hard to see with all the jumps ;)

In a benchmark like fannkuch I would not expect to have any Java calls left in the graph. For example, we have none left when I run it using Ruby. Fannkuch is about reading and writing arrays and we should be able to do all of that without a call.

I would recommend looking at each of these Java calls and working out how to eliminate them through specialisation, guarding and caching using the normal Truffle techniques. You could give us some examples of calls that you aren’t sure how to remove and we can help you figure it out.

> The graph viewer is very interesting, but so many nodes are generated that
> I can't really figure out what's going on there either. I'm assuming that
> it's not too much of a problem if some calls won't get inlined, as long as
> those are not in the slow path.

It can be hard to read these graphs. When I see something I’m interested in from a big graph I usually try to simplify and work with micro benchmarks to isolate it, but that’s not always easy.

> What I'd like to have is a simple profiler (preferably one using sampling),
> that will point me to the actual slow statements in the source program. Is
> something like that available or will I have to write something myself? In
> the last case, I suppose I should be using the the Truffle Instrumentation
> API[2]?
> Regards,
> Gerard
> [1]
> [2]

More information about the graal-dev mailing list