From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: * X-Spam-Status: No, score=1.2 required=5.0 tests=AWL,SPF_SOFTFAIL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 57FA9BC6B for ; Tue, 10 Jul 2007 18:49:21 +0200 (CEST) Received: from smtp.janestcapital.com (www.janestcapital.com [66.155.124.107]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l6AGnKv2023955 for ; Tue, 10 Jul 2007 18:49:20 +0200 Received: from [172.25.131.105] [38.96.172.125] by janestcapital.com with ESMTP (SMTPD-9.10) id A8A20418; Tue, 10 Jul 2007 12:49:38 -0400 Message-ID: <4693B88E.9000408@gnu.org> Date: Tue, 10 Jul 2007 12:49:18 -0400 From: Sam Steingold User-Agent: Thunderbird 2.0.0.0 (X11/20070326) MIME-Version: 1.0 To: Jacques Garrigue Cc: caml-list@inria.fr Subject: Re: large parametrized polymorphic variant type combinations take forever to compile References: <4666E11F.6000308@podval.org> <4692991E.8040205@gnu.org> <20070710.083733.116353766.garrigue@math.nagoya-u.ac.jp> In-Reply-To: <20070710.083733.116353766.garrigue@math.nagoya-u.ac.jp> X-Enigmail-Version: 0.95.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 4693B890.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; parametrized:01 hash:01 variants:01 compilation:01 compilation:01 variants:01 parametric:01 ocamlc:01 -version:01 1,000:98 1,000:98 polymorphic:01 polymorphic:01 wrote:01 compile:01 -----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-----