From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q2B9Ll2p025046 for ; Sun, 11 Mar 2012 10:21:47 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApIDAGhtXE/RVdK2kmdsb2JhbABChUSeRJE+CCIBAQEBCQsLBxIpggkBAQEEEgIPHQEbEgsBAwwGBQsNAgIJHQICIQEBEQEFAQoSBhMSDASHaAuhLgqLLEyCcYQWP4EMAQULgSSIFYYngRYElUyLK4MaPYQF X-IronPort-AV: E=Sophos;i="4.73,566,1325458800"; d="scan'208";a="148677278" Received: from mail-iy0-f182.google.com ([209.85.210.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 11 Mar 2012 10:21:41 +0100 Received: by iahk25 with SMTP id k25so7847669iah.27 for ; Sun, 11 Mar 2012 01:21:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=IUuzDUg9Lgl+m9dc5ONeM0VaIaCe9Kuj3gEMiF4KOyg=; b=Ccgmkb4l30DtdzGWWUXTtlK34JFg6UyBhHWzkFvu3Qgy2qUGndu5hOymyCGjaIwjWR U30nleAEiyoZAdnoHrFp1J0g7Xd13/DXySw59O1OFYXd8G8dqq5YPMwSCgiJovDN0iSy BKmDmFiLw2lBO1RHuglElvaaWOyr0yy0EiRDAkBoSBkZBaDzxeTVBc8x5G26eCGzmyRY iJRb2e796Zo0v9Z+pO0hPXRCwgeZRjUvkbMogPhSxW+KVIRq95B/FDB2ndVsgqv0zaYM SBIxEChrrUnUcS2dXWzi4IWKWfSxtMUxA5JsTCFIih4+Gnj8EG5hkWNQjWpzwPfLGf5i e4sQ== MIME-Version: 1.0 Received: by 10.43.52.74 with SMTP id vl10mr10545112icb.55.1331457700664; Sun, 11 Mar 2012 01:21:40 -0800 (PST) Received: by 10.42.142.130 with HTTP; Sun, 11 Mar 2012 01:21:40 -0800 (PST) In-Reply-To: References: Date: Sun, 11 Mar 2012 10:21:40 +0100 Message-ID: From: Raphael Proust To: SerP Cc: caml-list Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q2B9Ll2p025046 Subject: Re: [Caml-list] Very slow compilation 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. The same probably applies with plain ocaml. (It might be that objects/classes typing is more complicated due to sub-typing, although someone with insider knowledge would know better.) On Sun, Mar 11, 2012 at 9:39 AM, Gabriel Scherer wrote: > I can't comment on the type-checker internals, but a general first > step would be to make sure that you don't recompile things that you > don't need to. > > If you change the *implementation* of a module without changing its > interface, you should not have to recompile any other module, at least > when using bytecode compilation. You need not recompile even the > modules that depend on this -- there is only an > interface-dependency. With native compilation, the compiler can > inspect depending modules to perform some cross-module optimizations, > so there will be an implementation-dependency by default, but you can > disable it -- the .cmx for bar.ml won't depend on its dependency > foo.ml if foo.cmx is not available at compile time. It's simpler to > just use ocamlc for development. It's also faster at code generation, > but apparently your bottleneck is typing. > > To fully benefit from separate compilation, you may want to have > a slightly more fine-grained separation of you program into > compilation units. If a given module interface can be split in two > parts, one that evolves slowly and on which a lot of modules depend, > and one that is little used outside but changes frequently, it's a big > win to split it into two separate module interfaces -- when you can, > eg. the whole thing is not encapsulated as a functor. > > On Sun, Mar 11, 2012 at 9:11 AM, SerP wrote: >> We encountered a problem of a slow compilation. When the project grew up, >> the time of compilation increased considerably. We have many classes and >> objects, and the type checking of objects and classes performs very slowly. >> I have Core i3 3GHz iMac, and the average compilation time of one module is >> 7-13 seconds. The entire projet is compiled within 10-15 minutes. The major >> part of the time is taken by "Typemod.type_implementation", which include >> many calls of Ctype.unify (80% of compilation time). Now, it is getting hard >> and slow to develop the projetct, are there any ways to accelarate it? It is >> difficult to get all fine points, but I wish I could make the process >> faster. Thanks for any help or comments. Looking forward to your reply > > > -- > 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 > -- _______ Raphael