Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: "Gerd Stolpmann" <info@gerd-stolpmann.de>
To: "Matti Jokinen" <moj@tanssi.net>
Cc: "Raphael Proust" <raphlalou@gmail.com>,
	"SerP" <serp256@gmail.com>, "caml-list" <caml-list@inria.fr>
Subject: Re: [Caml-list] Very slow compilation
Date: Tue, 13 Mar 2012 23:46:40 +0100	[thread overview]
Message-ID: <f86bae946250d577ed05410c3845d1e4.squirrel@gps.dynxs.de> (raw)
In-Reply-To: <20120313220202.GA29196@kiuru>


>> When working with ocamlduce (a few years ago) the same problem was
>> raised. A simple thing that can greatly reduce typing time is putting
>> explicit type annotations. Although the verbosity is increased it is
>> not that much of a burden if the annotated parts do not evolve too
>> much.
>
> In my experience, ocamlduceopt/ocamlduceopt.opt slows down regularly when
> the source file approaches 1000 lines of OCamlDuce code.  The compilation
> time then grows rapidly: in this machine (Thinkpad R5000) 1000 lines
> took 20 seconds, 2000 lines 2 minutes, 3000 lines hanged the system.
> Only OCamlDuce code causes slowdown, pure OCaml is compiled rapidly even
> by OCamlDuce compilers.
>
> However, it is not typechecking that takes time.  The time-consuming
> step appears to be register allocation.  Try:

I've observed the same problem with code generated by the Hydro RPC
library (using standard ocamlopt). This library can generate a very long
set of mutually recursive functions, and the time spent by ocamlopt seemed
to explode (compilation took minutes). ocamlc was not affected.

The fix was to change the code generator, and to break the recursion into
smaller pieces.

> ocamldebug /usr/bin/ocamlduceopt -c big_ocamlduce_module.ml
> run
> ... wait about two minutes and press control-C
>
> You will probably find the compiler executing a function from modules
> such as Interf, Coloring or Spill, or a lower level function called
> from these modules.

This was also my observation.

> I have never observed anything similar in OCaml, but ocamlduceopt
> appears to use unmodified ocamlopt code generation modules.  I wonder
> what is the critical difference between OCamlDuce code and typical
> OCaml code at this level.

I guess the only difference is the length of the code passed at once to
the backend, since you can generate code showing this problem for standard
ocamlopt, as in my Hydro case.

Gerd

>
> - Matti Jokinen
>
> --
> 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
>
>
>


-- 
Gerd Stolpmann, Darmstadt, Germany    gerd@gerd-stolpmann.de
Creator of GODI and camlcity.org.
Contact details:        http://www.camlcity.org/contact.html
Company homepage:       http://www.gerd-stolpmann.de
*** Searching for new projects! Need consulting for system
*** programming in Ocaml? Gerd Stolpmann can help you.



  reply	other threads:[~2012-03-13 22:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-11  8:11 SerP
2012-03-11  8:39 ` Gabriel Scherer
2012-03-11  9:04   ` Adrien
2012-03-11  9:21   ` Raphael Proust
2012-03-13 22:02     ` Matti Jokinen
2012-03-13 22:46       ` Gerd Stolpmann [this message]
2012-03-14  5:33         ` Gabriel Scherer
2012-03-14  8:52         ` Pierre Chambart
2012-03-13 16:58 ` Richard W.M. Jones
2012-03-14 14:45 tools

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=f86bae946250d577ed05410c3845d1e4.squirrel@gps.dynxs.de \
    --to=info@gerd-stolpmann.de \
    --cc=caml-list@inria.fr \
    --cc=moj@tanssi.net \
    --cc=raphlalou@gmail.com \
    --cc=serp256@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