caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "forum@x9c.fr" <forum@x9c.fr>
To: mukesh tiwari <mukeshtiwari.iiitm@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Calling Java function from OCaml
Date: Thu, 12 Apr 2018 19:57:02 +0100	[thread overview]
Message-ID: <6AE89499-0C31-4798-BC90-B5712709E405@x9c.fr> (raw)
In-Reply-To: <CAFHZvE_0v=JjNddjhDfYq4=NyuUoOCKaWRwQscjBQ1KBLrOyJw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1827 bytes --]


> Le 12 avr. 2018 à 10:40, mukesh tiwari <mukeshtiwari.iiitm@gmail.com> a écrit :
> 
> Hi Everyone, 
> I am trying to call some Java functions from OCaml (Extracted from Coq if it matters). I am familiar with ocamljava [1], but it says that "The generated code usually runs faster than OCaml bytecode but slower than native code. Memory consumption and startup time are also higher, but leveraging the multiple cores of a machine can help reaching the performance level of native code.", and I don't want to leave the OCaml native code. One suggestion I got on #ocaml channel is using RPC and a quick Google search leads to ocaml-rpc [2].  I am wondering if experts from OCaml community could please give me some suggestions. 

For the record, the performance of ocamljava-compiled code
heavily depends on the programming style. Numerical imperative
or i/o-bound code can be on par with ocamlopt-compiled code,
while code based on exceptions for control flow or abundant indirect
calls can be slower than ocamlc-compiled code. I am afraid
extracted code is likely to fall in the second category.

It is also noteworthy that you can run into problems with extracted
code. I suspect extracted code might contain call to "Obj.magic",
as the type system of Coq is slightly more powerful than the one
of OCaml. The issue is that that OCaml-Java uses a different
memory layout, so that "Obj.magic" might not yield the same result
as in vanilla OCaml.


Best regards,

Xavier Clerc

PS: if you are able to share your code, I might be able to give you
a less generic assessment.

-- 
Caml-list mailing list.  Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

[-- Attachment #2: Type: text/html, Size: 2425 bytes --]

  parent reply	other threads:[~2018-04-12 18:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-12  9:40 mukesh tiwari
2018-04-12 10:00 ` Gabriel Scherer
2018-04-12 19:06   ` forum
2018-04-12 18:57 ` forum [this message]
2018-04-13  3:01   ` mukesh tiwari
2018-04-15 18:26     ` forum

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=6AE89499-0C31-4798-BC90-B5712709E405@x9c.fr \
    --to=forum@x9c.fr \
    --cc=caml-list@inria.fr \
    --cc=mukeshtiwari.iiitm@gmail.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).