[LLVMdev] OCaml bindings to LLVM

Jon Harrop jonathandeanharrop at googlemail.com
Mon Sep 8 13:47:15 PDT 2008


On Monday 08 September 2008 20:17:01 Gordon Henriksen wrote:
> On 2008-09-05, at 23:26, Jon Harrop wrote:
> > I'm having another play with LLVM using the OCaml bindings for a
> > forthcoming
> > OCaml Journal article and I have a couple of remarks:
> >
> > Firstly, I noticed that the execute engine is very slow, taking
> > milliseconds to call a JIT compiled function. Is this an inherent
> > overhead or am I calling it incorrectly or is this something that
> > can be optimized in the OCaml bindings?
>
> The high-level calling convention using GenericValue is going to be
> very slow relative to a native function call. This is true in C++, but
> even moreso in Ocaml, which must cons up a bunch of objects on the
> heap for each call.

Unless tens of thousands of allocations are made for every call, I do not 
believe that explains the performance discrepancy I quantified. A millisecond 
is a long time in this context.

Does it spawn or fork a process?

-- 
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultancy.com/?e



More information about the llvm-dev mailing list