From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by c5ff346549e7 (Postfix) with ESMTPS id A94575D5 for ; Thu, 12 Apr 2018 18:57:22 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.48,443,1517871600"; d="scan'208,217";a="322607166" Received: from sympa.inria.fr ([193.51.193.213]) by mail2-relais-roc.national.inria.fr with ESMTP; 12 Apr 2018 20:57:19 +0200 Received: by sympa.inria.fr (Postfix, from userid 20132) id 8E3FD82450; Thu, 12 Apr 2018 20:57:19 +0200 (CEST) Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id 68E478240C for ; Thu, 12 Apr 2018 20:57:14 +0200 (CEST) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=forum@x9c.fr; spf=Pass smtp.mailfrom=forum@x9c.fr; spf=None smtp.helo=postmaster@6.mo177.mail-out.ovh.net IronPort-PHdr: =?us-ascii?q?9a23=3AO/i+dRXaILzDc3W2z0/xo95p+sXV8LGtZVwlr6E/?= =?us-ascii?q?grcLSJyIuqrYYxWBt8tkgFKBZ4jH8fUM07OQ7/i7HzRYqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjWwba98IRmssQndqtQdjJd/JKo21hbHuGZDdf?= =?us-ascii?q?5MxWNvK1KTnhL86dm18ZV+7SleuO8v+tBZX6nicKs2UbJXDDI9M2Ao/8LrrgXM?= =?us-ascii?q?TRGO5nQHTGoblAdDDhXf4xH7WpfxtTb6tvZ41SKHM8D6Uaw4VDK/5KptVRTmij?= =?us-ascii?q?oINyQh/W7LhcN+kaJVrxCvqRJ8zY7afoabOeFkca/BeNMXX2pBUtpTWiFHH4iy?= =?us-ascii?q?b5EPD+0EPetAoYX9qVwOrQGjBQmpH+7uxTtFiWPs0a00yeQtHxzN0QsuH9IJqn?= =?us-ascii?q?TUsdD1ObwdUO2x0KbE1zvDb+lP1Dr79YPGcQghrOmDUL9xa8bd1FUjGgPfgliQ?= =?us-ascii?q?tIDpJS2Z2+sJvmSD8eZsT/yjhm49pwxxozWj3NoghpXLi48T11vK7z92wJwvKt?= =?us-ascii?q?29UEN7YcCrEJ9XtyyCNoZ6WMYiQ2Z1tCs4yLAKo5u7czILyJQj3hLfbOGHc5SS?= =?us-ascii?q?7hLkSuaRIS10hHR7d7Kjnxqy8E6gxfPgVsSs31tHrzBJnsTQun0NzRDe6tWLRu?= =?us-ascii?q?Fj8kqu3TuDzwXT5ftFIUAwm6rbMZkhwrsom5odtkTDBDL2mEDtga6Zckgr5vKk?= =?us-ascii?q?6+r9Yrn+vJ+TK5d0ih3iMqQpgsGwHf43Mg0KX2SC/eS81abj/VHiTbVRjvw2l7?= =?us-ascii?q?HZv4rAKcQaoK65GQ5V3Zw55xaxFTf1mOgfyHwaL19eeFqbjpfgIVCGdPXlDvqk?= =?us-ascii?q?g0itjz5xxrbHP7z9B73CK3HClPHqerMruGBGzw9mh95Y/Y9RIqFQK7T9QAW54N?= =?us-ascii?q?LfFAI8GxzlyKDpEoMuhcslRWuTD/rBY+vpuliS67d3erjeVMouoD/4bsMdybvr?= =?us-ascii?q?hH49l0UaePn7zcocLn6iTK0/fxepJEH0i9JEKl8k+xIkRby4mAyJFzBJNS7rAv?= =?us-ascii?q?AMowojAYfjNr/tA4CghLvbgnXlWJhRPz8ZTFWFEHOtcJiYHfASaGSUL9MzyjE?= =?us-ascii?q?=3D?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AvAwC+qs9ah/kzaS5cHgEGDIMXgQ9sK?= =?us-ascii?q?INjlmchgQ+DK4M7jXkLhQMCCIIZGQcBBDQUAQIBAQEBAQEBAQETAQEBCA0JCCg?= =?us-ascii?q?vgjUigksBAQEBAgEjSA4FCwsEPgICITYGExSEYQMNDKdCghyHBw1nRIIviFGBP?= =?us-ascii?q?4EyDIIuLoJPhSQwgQw5XwKQX4ZSLAgCbYpNhDCDWoI4hQGJYoNhglGBJTNUgR9?= =?us-ascii?q?0EToqAYIYPoFwgQMBCI0Vbo9YAQE?= X-IPAS-Result: =?us-ascii?q?A0AvAwC+qs9ah/kzaS5cHgEGDIMXgQ9sKINjlmchgQ+DK4M?= =?us-ascii?q?7jXkLhQMCCIIZGQcBBDQUAQIBAQEBAQEBAQETAQEBCA0JCCgvgjUigksBAQEBA?= =?us-ascii?q?gEjSA4FCwsEPgICITYGExSEYQMNDKdCghyHBw1nRIIviFGBP4EyDIIuLoJPhSQ?= =?us-ascii?q?wgQw5XwKQX4ZSLAgCbYpNhDCDWoI4hQGJYoNhglGBJTNUgR90EToqAYIYPoFwg?= =?us-ascii?q?QMBCI0Vbo9YAQE?= X-IronPort-AV: E=Sophos;i="5.48,443,1517871600"; d="scan'208,217";a="261870645" Received: from 6.mo177.mail-out.ovh.net ([46.105.51.249]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 12 Apr 2018 20:57:13 +0200 Received: from player687.ha.ovh.net (unknown [10.109.120.50]) by mo177.mail-out.ovh.net (Postfix) with ESMTP id 95E4C9F889 for ; Thu, 12 Apr 2018 20:57:12 +0200 (CEST) Received: from [192.168.1.4] (unknown [2.25.56.107]) (Authenticated sender: forum@x9c.fr) by player687.ha.ovh.net (Postfix) with ESMTPSA id F06912C008C; Thu, 12 Apr 2018 20:57:10 +0200 (CEST) Content-Type: multipart/alternative; boundary="Apple-Mail=_6C227A22-E7FE-47F1-ACCA-44531D8169E4" Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) From: "forum@x9c.fr" In-Reply-To: Date: Thu, 12 Apr 2018 19:57:02 +0100 Cc: caml-list@inria.fr Message-Id: <6AE89499-0C31-4798-BC90-B5712709E405@x9c.fr> References: To: mukesh tiwari X-Mailer: Apple Mail (2.3124) X-Ovh-Tracer-Id: 12396157976954274782 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtgedriedtgdduuddtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenuc Subject: Re: [Caml-list] Calling Java function from OCaml Reply-To: "forum@x9c.fr" X-Loop: caml-list@inria.fr X-Sequence: 16803 Errors-to: caml-list-owner@inria.fr Precedence: list Precedence: bulk Sender: caml-list-request@inria.fr X-no-archive: yes List-Id: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --Apple-Mail=_6C227A22-E7FE-47F1-ACCA-44531D8169E4 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > Le 12 avr. 2018 =C3=A0 10:40, mukesh tiwari a =C3=A9crit : >=20 > Hi Everyone,=20 > 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 gener= ated code usually runs faster than OCaml bytecode but slower than native co= de. Memory consumption and startup time are also higher, but leveraging the= multiple cores of a machine can help reaching the performance level of nat= ive 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 oc= aml-rpc [2]. I am wondering if experts from OCaml community could please g= ive me some suggestions.=20 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. --=20 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= --Apple-Mail=_6C227A22-E7FE-47F1-ACCA-44531D8169E4 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
Le 12 avr. 2018 =C3= =A0 10:40, mukesh tiwari <mukeshtiwari.iiitm@gmail.com> a =C3=A9crit :

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=20 than native code. Memory consumption and startup time are also higher,=20 but leveraging the multiple cores of a machine can help reaching the=20 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 qui= ck Google search leads to ocaml-rpc [2].  I am wondering if experts fr= om OCaml community could please give me some suggestions.

For the r= ecord, 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 e= xceptions for control flow or abundant indirect
calls can be slow= er than ocamlc-compiled code. I am afraid
extracted code is likel= y to fall in the second category.

It is= also noteworthy that you can run into problems with extracted
co= de. I suspect extracted code might contain call to "Obj.magic",
a= s the type system of Coq is slightly more powerful than the one
o= f OCaml. The issue is that that OCaml-Java uses a different
memor= y 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 migh= t be able to give you
a less generic assessment.
= --Apple-Mail=_6C227A22-E7FE-47F1-ACCA-44531D8169E4--