Browse thread
OCamlJIT2 vs. OCamlJIT
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2010-11-30 (22:06) |
From: | Jon Harrop <jonathandeanharrop@g...> |
Subject: | RE: [Caml-list] OCamlJIT2 vs. OCamlJIT |
Yoann wrote: > Yes, and it has to stop. I don't understand why there is so much hype around LLVM. Why > would you think something written in C++ would be far better than the ocaml code we have > in the ocamlopt compiler? Because benchmarks like my HLVM ones have proven that LLVM can generate *much* faster code than ocamlopt does. For example, Fibonacci function over floats in HLVM with optimization passes disabled and compilation time included in the measurement: # let rec fib (x: float) : float = if x < 1.5 then x else fib(x - 1.0) + fib(x - 2.0);; # fib 40.0;; - : `Float = 1.02334e+08 Live: 0 2.48074s total; 0s suspend; 0s mark; 0s sweep And ocamlopt without compilation time: $ cat >fib.ml let rec fib x = if x < 1.5 then x else fib(x -. 1.0) +. fib(x -. 2.0);; fib 40.0;; $ ocamlopt fib.ml -o fib $ time ./fib real 0m7.811s user 0m7.808s sys 0m0.000s Note that HLVM's *REPL* is over 3x faster than ocamlopt-compiled OCaml. I have microbenchmarks where LLVM generates code over 10x faster than ocamlopt (specifically, floating point code on x86) and larger numerical programs that also wipe the floor with OCaml. LLVM is also much better documented than ocamlopt's internals. Cheers, Jon.