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=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 81576BBC4 for ; Sat, 21 Feb 2009 19:53:20 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArEDAFvcn0mK54gDgWdsb2JhbACUXAEBFiK+VYQPBg X-IronPort-AV: E=Sophos;i="4.38,246,1233529200"; d="scan'208";a="21493511" Received: from rouge.crans.org ([138.231.136.3]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/ADH-AES256-SHA; 21 Feb 2009 19:53:20 +0100 Received: from localhost (localhost.crans.org [127.0.0.1]) by rouge.crans.org (Postfix) with ESMTP id C54FA8609; Sat, 21 Feb 2009 19:53:19 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at crans.org Received: from rouge.crans.org ([10.231.136.3]) by localhost (rouge.crans.org [10.231.136.3]) (amavisd-new, port 10024) with LMTP id OiISmqokym2U; Sat, 21 Feb 2009 19:53:19 +0100 (CET) Received: from [138.231.144.231] (bardou.wifi.crans.org [138.231.144.231]) by rouge.crans.org (Postfix) with ESMTP id A03208076; Sat, 21 Feb 2009 19:53:19 +0100 (CET) Message-ID: <49A04DAE.6010109@lri.fr> Date: Sat, 21 Feb 2009 19:53:34 +0100 From: Romain Bardou User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: =?ISO-8859-1?Q?Daniel_B=FCnzli?= Cc: OCaml List Subject: Re: [Caml-list] ocamlbuild & deps References: <499ECEB7.6010709@lri.fr> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Spam: no; 0.00; lri:01 deps:01 bunzli:01 compilation:01 compilation:01 dependencies:01 parallelism:01 dependencies:01 parallelism:01 wrote:01 dynamically:01 dynamically:01 compile:01 compile:01 caml-list:01 Daniel Bünzli wrote: > > Le 20 févr. 09 à 16:39, Romain Bardou a écrit : > >> I think there is a difference. It is indeed an optimization issue but >> not at the level of Ocamlbuild itself : it is as the level of your >> compilation process. If A *dynamically* depends on B, and your whole >> project (say, 10 hours of compilation) depends on A, but you have no >> way to build B, then Ocamlbuild will start to compile your project >> until it finds out that A cannot be built (maybe several hours later). >> If B had been put as a ~dep, then Ocamlbuild would not even had >> started building the project in the first place, saving you a lot of >> time. > > Heu no. If B cannot be built then the compilation of A stops and the > compilation of your project stops. > > It is however true that if A has a dependency on a heavy C in parallel > to B you'll have to wait for the end of C. But even in this case, it's > just a matter of calling 'build' with B and C in a sensible order (and > not in parallel). Ok I think I did not explain correctly. Let's say that : - A dynamically depends on B - A depends on C - B cannot be built Now if I try to build A, C will be built, then the rule to build A will be applied and the dependency on B will be discovered. But B cannot be built so the compilation fails. Now if the compilation of C takes 10 hours, you will have to wait 10 hours no matter what. "Damn, I waited 10 hours just to discover that it cannot compile!" If the dependency on B was not dynamic, C would not have been built at all. So, there is indeed a difference between dynamic and static dependencies, with or without parallelism. In fact, dynamic dependencies also tend to break parallelism as dynamic dependencies cannot be built at the same time as static dependencies. In my example, C and B cannot be built in parallel. This is another difference. You cannot, in general, run the rule to discover dynamic dependencies before building static dependencies. Indeed, what if the rule needs to read one of the static dependencies to discover other dependencies? -- Romain Bardou