Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Virgile Prevosto <virgile.prevosto@m4x.org>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] a question about "ocamlopt" and "ocamldep"
Date: Wed, 14 Mar 2012 18:12:07 +0100	[thread overview]
Message-ID: <CAPFanBGAcpdSs=MAvAV9Q7FfeZ9Ovh1EyFxfS83TmSOxWmXbFA@mail.gmail.com> (raw)
In-Reply-To: <CA+yPOVhgqB4mqHovXZztxvB7W60HH=o2qST_gXFLkvGJYaJ5Cw@mail.gmail.com>

Indeed, ocamlc is faster than ocamlopt (because there is less analysis
in the backend, and simply less work to do to bridge the expressivity
gap) and suited for fast compile-and-edit cycles.

There are occasional cases when I've seen a use for ocamlopt, when I
needed to integrate a "run automated tests" in my feedback loop, and
some tests where noticeably faster when natively compiled. I must
admit I have never give a thought to the .cmx handling, as that has
never appeared to be an issue in the past. I'm not sure how hard it is
to integrate a "no .cmx dependency" pass in the Makefile; intuitively,
just doing "mv *.cmx cmx_save_dir/" before each compilation command
ought to be enough.

It might be interesting to add a "don't depend on .cmx" option to the
compiler, so that it's only a flag to add somewhere in your build
system. Given the existence of ocamlc, there is few incentive for
this, and apparently the OCaml maintainers have not considered it
high-priority. See the following bug report (and do not hesitate to
comment there if you are sure that, indeed, you have a real need for
this feature):
  http://caml.inria.fr/mantis/view.php?id=4389

The following bug report is also related to .cmx/.cmxa and
implementation dependency (short story: if as a library provider you
want your users to be able to cross-optimize with the library code,
providing .cmxa is not enough, you also have to provide the separate
.cmx):
  http://caml.inria.fr/mantis/view.php?id=4772

On Wed, Mar 14, 2012 at 2:19 PM, Virgile Prevosto
<virgile.prevosto@m4x.org> wrote:
> 2012/3/14 Matej Košík <5764c029b688c1c0d24a2e97cd764f@gmail.com>:
>
>> There are two scenarios when I use the compiler:
>>
>> Scenario 1 (most frequent): when I want to incrementally remove typing
>> errors during development. Various optimizations do not matter here.
>> What matters is a short time to rebuild everything (that has to be rebuilt).
>>
>> Scenario 2 (rare one): to produce the final product
>> where quality of various optimizations matter more than
>> the amount of required compilation time
>>
>> If dropping dependencies of *.cmx files on other *.cmx files (rather
>> than on *.cmi files) requires manual intervention or careful thinking,
>> then ocamlopt, with this behavior, is not ideal tool for Scenario 1
>> (while still being perfectly suitable for Scenario 2).
>
> Scenario 1 is exactly what bytecode compilation is for, and it is
> indeed fast and without dependencies on .cmo.
>
>
>
>
>
> --
> E tutto per oggi, a la prossima volta
> Virgile
>
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


  reply	other threads:[~2012-03-14 17:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-14 10:31 Matej Košík
2012-03-14 11:23 ` Gabriel Scherer
2012-03-14 12:38   ` Matej Košík
2012-03-14 13:19     ` Virgile Prevosto
2012-03-14 17:12       ` Gabriel Scherer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-03-13 18:19 Matej Košík
2012-03-13 18:34 ` Matthias Puech
2012-03-13 19:26   ` Gabriel Scherer

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='CAPFanBGAcpdSs=MAvAV9Q7FfeZ9Ovh1EyFxfS83TmSOxWmXbFA@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=virgile.prevosto@m4x.org \
    /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