caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Sam Steingold <sds@gnu.org>
To: Jacques Garrigue <garrigue@math.nagoya-u.ac.jp>
Cc: caml-list@inria.fr
Subject: Re: large parametrized polymorphic variant type   combinations take forever to compile
Date: Tue, 10 Jul 2007 12:49:18 -0400	[thread overview]
Message-ID: <4693B88E.9000408@gnu.org> (raw)
In-Reply-To: <20070710.083733.116353766.garrigue@math.nagoya-u.ac.jp>

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

Jacques Garrigue wrote:
> 
> Could you send me your real code, so that I can see whether something
> unexpected is happening?

here is some more information:
file http://sds.podval.org/data/small.zip includes 6 files:

small1.ml small2.ml : define large (~1,000 variants) polymorphic variant
types (non-parametric).
compilation time: ~20 sec each.
small.ml : use small1.ml & small2.ml:
================ small.ml ====================
type t3 = [
| Small1.t1
| Small2.t2
]

let f ~fa ~fb ~fc = function
  | # Small1.t1 as x -> Small1.f ~fa ~fb x
  | # Small2.t2 as x -> Small2.f ~fa ~fb ~fc x
================ small.ml ====================
compilation time:
real    1m28.063s
user    1m8.628s
sys     0m0.828s

smallp1.ml smallp2.ml : define large (~1,000 variants) parametric
polymorphic variant types.
compilation time: ~20 sec each (same as non-parametric)
small_p.ml: use smallp1.ml smallp2.ml:
================ small_p.ml ====================
type ('a,'b,'c) t3 = [
| ('a,'b) Smallp1.t1
| ('a,'b,'c) Smallp2.t2
]

let f ~fa ~fb ~fc = function
  | # Smallp1.t1 as x -> Smallp1.f ~fa ~fb x
  | # Smallp2.t2 as x -> Smallp2.f ~fa ~fb ~fc x
================ small_p.ml ====================
compilation time:
real    29m31.639s
user    25m49.929s
sys     0m10.937s

note that the use of type parameters increased compilation time of "|#"
by a factor of 20!

$ ocamlc -version
3.09.3

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

iD8DBQFGk7iOPp1Qsf2qnMcRAvVaAKCDfgmyWfvQ4wQA5T6n8PfcIdxWJwCgi6i+
ds8yKZ7tkgFoe4LqXaumV9w=
=+jXg
-----END PGP SIGNATURE-----


  parent reply	other threads:[~2007-07-10 16:49 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
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 [this message]
     [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=4693B88E.9000408@gnu.org \
    --to=sds@gnu.org \
    --cc=caml-list@inria.fr \
    --cc=garrigue@math.nagoya-u.ac.jp \
    /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).