caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Florent Monnier <fmonnier@linux-nantes.fr.eu.org>
To: caml-list@yquem.inria.fr
Cc: Jon Harrop <jon@ffconsultancy.com>
Subject: Re: [Caml-list] Using OCaml's run-time from LLVM-generated native code
Date: Wed, 6 Feb 2008 00:08:08 +0100	[thread overview]
Message-ID: <200802060008.08563.fmonnier@linux-nantes.fr.eu.org> (raw)
In-Reply-To: <200802041336.22550.jon@ffconsultancy.com>

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?


      parent reply	other threads:[~2008-02-05 23:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-01 21:24 Jon Harrop
2008-02-03 21:24 ` [Caml-list] " Alain Frisch
2008-02-03 23:19   ` Jon Harrop
2008-02-04  7:03     ` Alain Frisch
2008-02-04 10:32       ` Jon Harrop
2008-02-04 11:11         ` Alain Frisch
2008-02-04 13:36           ` Jon Harrop
2008-02-04 15:20             ` Alain Frisch
2008-02-05 23:08             ` Florent Monnier [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200802060008.08563.fmonnier@linux-nantes.fr.eu.org \
    --to=fmonnier@linux-nantes.fr.eu.org \
    --cc=caml-list@yquem.inria.fr \
    --cc=jon@ffconsultancy.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).