caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sam Steingold <sds@gnu.org>
To: caml-list@inria.fr
Subject: Re: large parametrized polymorphic variant type   combinations take forever to compile
Date: Mon, 09 Jul 2007 18:45:56 -0400	[thread overview]
Message-ID: <4692BAA4.1030405@gnu.org> (raw)
In-Reply-To: <4692991E.8040205@gnu.org>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Sam Steingold wrote:
> Hi,
> continuing the saga started in
> http://permalink.gmane.org/gmane.comp.lang.caml.inria/37496
> I have 3 files: f1.ml, f2.ml, and f.ml:
> === f1.ml ===
> type ('a,'b) t1 = [
> | `t1_a of 'a
> | `t1_b of 'b
> ]
> 
> let f ~fa ~fb = function
>   | `t1_a a -> fa a
>   | `t1_b b -> fb b
> === f1.ml ===
> 
> === f2.ml ===
> type ('a,'b,'c) t2 = [
> | `t2_a of 'a
> | `t2_b of 'b
> | `t2_c of 'c
> ]
> 
> let f ~fa ~fb ~fc = function
>   | `t2_a a -> fa a
>   | `t2_b b -> fb b
>   | `t2_c c -> fc c
> === f2.ml ===
> 
> === f.ml ===
> type ('a,'b,'c) t3 = [
> | ('a,'b) F1.t1
> | ('a,'b,'c) F2.t2
> ]
> 
> let f ~fa ~fb ~fc = function
>   | # F1.t1 as x -> F1.f ~fa ~fb x
>   | # F2.t2 as x -> F2.f ~fa ~fb ~fc x
> === f.ml ===
> 
> except that the number of variants is not 2-3 but 800 for f1 and 3000
> for f2 (the number of parameter types ('a,'b,'c) is 3).
> compiling f1.ml and f1.ml takes 10-30 minutes (of 40% less if I use 3.10).
> compiling f.ml takes forever. literally. it has been running for 5+
> hours now and there is no sign of hope (all it has produces so far is an
> empty f.cmo):
> 27820 sds       25   0 1343m 1.3g 1576 R   98 37.2 306:01.80 ocamlc.opt
> (the 3 sample files above compile reasonably fast, but my files are larger).
> the command line is
> ocamlfind ocamlc -dtypes -thread -w Ae -warn-error Ae -for-pack
> Tickslots -g -I . -c generic_tick.ml
> 
> is this a known problem?

more information: when t1 and t2 contain ~1,000 variants, both f1.ml and
f2.ml compile in a few seconds, but f.ml takes forever (10+ minutes).
splitting f.ml into 2 files indicates that its the function f, not type
t3 that is taking all the time.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGkrqkPp1Qsf2qnMcRAsjiAJ9uEH172bR+OWZZQ3naNcfOo4fS9ACeJD79
ACmrszDW34kO4OzyISu6H8I=
=N/CR
-----END PGP SIGNATURE-----


  reply	other threads:[~2007-07-09 22:45 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 16:30 compiling large file hogs RAM and takes a long time Sam Steingold
2007-06-06 16:51 ` [Caml-list] " skaller
2007-06-06 17:05   ` Sam Steingold
2007-06-07 15:52 ` Sam Steingold
2007-06-08  1:02   ` [Caml-list] " Jacques Garrigue
2007-06-08  1:51     ` skaller
2007-06-08  2:26       ` Yaron Minsky
2007-06-08  9:05       ` Thomas Fischbacher
2007-06-08  9:35         ` skaller
2007-06-08  9:55           ` Thomas Fischbacher
2007-06-08 13:39       ` Sam Steingold
2007-06-08 12:30     ` [Caml-list] " Jacques Garrigue
2007-06-15 15:41       ` Sam Steingold
2007-06-15 18:56         ` [Caml-list] " Jon Harrop
2007-06-15 20:06           ` Sam Steingold
2007-07-09 20:22 ` large parametrized polymorphic variant type combinations take forever to compile Sam Steingold
2007-07-09 22:45   ` Sam Steingold [this message]
2007-07-09 23:37   ` [Caml-list] " Jacques Garrigue
2007-07-10  7:09     ` Christophe Raffalli
2007-07-10  7:31       ` Jacques Garrigue
2007-07-10 14:16     ` Sam Steingold
2007-07-10 16:49     ` Sam Steingold
     [not found]     ` <46938BDA.1090605@podval.org>
2007-07-11  0:10       ` [Caml-list] " Jacques Garrigue
2007-07-11  1:19         ` Jon Harrop
2007-07-11  2:23           ` Jacques GARRIGUE
2007-07-11 13:12         ` Sam Steingold
2007-07-11 19:17           ` [Caml-list] " Jon Harrop
2007-07-10  3:34   ` [Caml-list] " skaller
2007-07-10 13:27     ` Sam Steingold

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=4692BAA4.1030405@gnu.org \
    --to=sds@gnu.org \
    --cc=caml-list@inria.fr \
    /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).