Browse thread
Using OCaml's run-time from LLVM-generated native code
-
Jon Harrop
-
Alain Frisch
-
Jon Harrop
-
Alain Frisch
-
Jon Harrop
-
Alain Frisch
-
Jon Harrop
- Alain Frisch
- Florent Monnier
-
Jon Harrop
-
Alain Frisch
-
Jon Harrop
-
Alain Frisch
-
Jon Harrop
-
Alain Frisch
[
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: | -- (:) |
| From: | Florent Monnier <fmonnier@l...> |
| Subject: | Re: [Caml-list] Using OCaml's run-time from LLVM-generated native code |
Hi,
Jon Harrop wrote:
> int apply(int n) {
> CAMLparam0();
> CAMLlocal2(nv, fibn);
> nv = copy_int64(n);
> fibn = fib(nv);
> caml_gc_full_major(0);
> CAMLreturn(Int64_val(fib(nv)));
> }
>
> Is that correct?
>
> Next, this C code is 4x slower than the ocamlopt-generated equivalent. What
> can be done to improve its performance without leaving C?
I don't know if it is a typo from you, or if it is me that don't understand
the code, but it seems that fib(nv) is computed twice.
Shouldn't the second one be replaced by fibn, the result of the first one?