From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 33561820A1 for ; Fri, 6 Sep 2013 22:51:34 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of fabrissimo@gmail.com) identity=pra; client-ip=209.85.212.46; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of fabrissimo@gmail.com designates 209.85.212.46 as permitted sender) identity=mailfrom; client-ip=209.85.212.46; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="fabrissimo@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-vb0-f46.google.com) identity=helo; client-ip=209.85.212.46; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="fabrissimo@gmail.com"; x-sender="postmaster@mail-vb0-f46.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: An4BAFQ/KlLRVdQuk2dsb2JhbABbhAEMwn0IFg4BAQEBBwsLCRQEJIIkAQEFQAErCgMBAwwBBQULDS4iEgEFARwGE4dwAw+gKY9VhCwnDYh1AQUMlBQDl3WPfRgpgWGCaTo X-IPAS-Result: An4BAFQ/KlLRVdQuk2dsb2JhbABbhAEMwn0IFg4BAQEBBwsLCRQEJIIkAQEFQAErCgMBAwwBBQULDS4iEgEFARwGE4dwAw+gKY9VhCwnDYh1AQUMlBQDl3WPfRgpgWGCaTo X-IronPort-AV: E=Sophos;i="4.90,857,1371074400"; d="scan'208";a="31854610" Received: from mail-vb0-f46.google.com ([209.85.212.46]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Sep 2013 22:51:32 +0200 Received: by mail-vb0-f46.google.com with SMTP id p13so2512881vbe.5 for ; Fri, 06 Sep 2013 13:51:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=NUZ6OtmfG/Z43ojty6jgt01VlHcxaUihtSukZDg/D3s=; b=OwQ+zqiVOYo+GnJZwlsmKTUUAH9N2UKK88gCgpJ9+OetQX8yW65q8/LB6wM7KZ/hkQ sXuXlmuJ1o6z4qwI93zl6+S7mAafOsK73PiCNljlnvaBmt3uiTupwgGVyqH2dqseV4TQ otQ69+6c6Mpn0ZmYUPMxaD5w3SXbGZTzsOkF1Y+lum5SRokDyvKGsKGJ0tHaX05ZOCMX EOy2QeJXSGdXL3DeoQJHiAjX/UjBOaWigycLwWmolS1HJISkNwzMGpyYhjmr+eZNMhsT d471/yuH9zjG2hxhKU7QOIibqNuvTKvYYfeSHoFVhgs30Ep55LdRkNbr29E1QnRqSkQp eakw== MIME-Version: 1.0 X-Received: by 10.220.46.72 with SMTP id i8mr4209040vcf.10.1378500692329; Fri, 06 Sep 2013 13:51:32 -0700 (PDT) Sender: fabrissimo@gmail.com Received: by 10.220.171.10 with HTTP; Fri, 6 Sep 2013 13:51:32 -0700 (PDT) In-Reply-To: <5229F284.5050806@inria.fr> References: <5229DEF9.7040706@inria.fr> <5229F284.5050806@inria.fr> Date: Fri, 6 Sep 2013 22:51:32 +0200 X-Google-Sender-Auth: GXAnC352MAD0WaT5qCJMtPnus68 Message-ID: From: Fabrice Le Fessant To: Romain Bardou Cc: Markus Mottl , "caml-list@inria.fr" Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Accelerating compilation On Fri, Sep 6, 2013 at 5:20 PM, Romain Bardou wrote: >>> 3) Parallel compilation in Ocamlbuild >>> >>> Of course it would help but it is not easy to implement so I'm just >>> putting it there to be exhaustive. >> >> I'm not sure what you are referring to, OCamlBuild does already >> support parallel builds. > > Does it? I actually thought the -j option was ignored. > > I just did a quick test and I gain about 5 seconds with -j on a 1min15 > build (I had cleaned, recompiled and recleaned before so that caching by > the file system would not impact the result too much), so it does seem > to be a *little* faster :) FWIW, I recently compiled Merlin with both ocamlbuild and ocp-build, on a quad-core with "-j 10" for both (the link to the ocp-build description file is in the latest OCamlPro's report), ocamlbuild needs 13s where ocp-build only needs 4s to compile everything. As Xavier suggested, I think the main problem is that ocamlbuild must discover the files to compile dynamically, starting from the last module, so it cannot parallelize much. On the contrary, ocp-build has the list of files in the description of the project, so for example, it can call ocamldep on all of them almost at the same time. ocp-build has an option to choose between digest and (timestamp + inode), the default. When I benchmarked the two modes, I could notice a small difference, but not more then 5%, so the digests are unlikely to be responsible for the problem. Finally, another optimization that could be considered for ocamlbuild is to call camlp4 only once per file, and then call ocamldep, ocamlc and ocamlopt on the preprocessed file. I could notice a huge difference on Core, for example, when this optimization was implemented first in ocp-build (about a 50% speed-up, if I remember well). --Fabrice