I am developing a high-level virtual machine built upon LLVM and
written in
OCaml that uses JIT compilation to execute OCaml-like code at break-
neck
speeds.
I just stumbled upon a weird performance result: compiling my VM
with ocamlc
and ocamlopt produces very different benchmark results for the
performance of
the generated code (which should be identical). For example, my
float-based
Fibonacci function becomes 70% slower if I use ocamlopt and some other
float-based functions also see big performance drops.
What is ocamlopt doing that might explain this? I assume it is
fiddling with
the floating point state somehow...
You didn't let us in on how it really works. You said "high-level
virtual machine
built upon LLVM and written in OCaml". LLVM means too many things to be
able to decipher what you mean, and your statement is too general.
I'm assuming, but that's forced, so don't shoot if I make an asinus
out of myself ;)
So, it's a VM and it runs native jit-ted code like say .net would. So
presumably you
have some OCaml code that then invokes jit and some native functions
to dispatch
to jit-ted code? Do you interpret any bytecode, or always compile? Do
you even
have to have any OCaml code running in the process where the jit-ted
code runs in?
I presume you use the LLVM infrastructure to do the jit-ting, but
without knowing
exactly what code runs in the process space of the application, it's
hard to tell
what's going on.
There's no floating point state to change that would slow things up
that much.
At least I have never seen anything like that. Maybe the FP exceptions
are being
fired somehow? You can always set a breakpoint in exception handler(s).
Cheers, Kuba
_______________________________________________
Caml-list mailing list. Subscription management:
http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
Archives: http://caml.inria.fr
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs