From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by walapai.inria.fr (8.13.6/8.13.6) with ESMTP id q28MQQuW005805 for ; Thu, 8 Mar 2012 23:26:26 +0100 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aj8CAM0wWU/RVdK2mGdsb2JhbABDhTWvbAgiAQEBAQEICQ0HFCeCCgEBAQQSAg8EGQE4AQMMAQUFCw0CAiYCAiEBEgEFARwGEyKHaJxvCosogz2FGokzAQULgSSICYYIgRYElUWHcYMxgxg9gVSCMQ X-IronPort-AV: E=Sophos;i="4.73,553,1325458800"; d="scan'208";a="135113055" Received: from mail-iy0-f182.google.com ([209.85.210.182]) by mail4-smtp-sop.national.inria.fr with ESMTP/TLS/RC4-SHA; 08 Mar 2012 23:26:20 +0100 Received: by iahk25 with SMTP id k25so2003892iah.27 for ; Thu, 08 Mar 2012 14:26:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=/QjWAqGXxbs5N1ZhxQ/+DFFsqbrlvg7CfWUwkDCRGS4=; b=cmDxWA4Qn8n6pGoLSlA9JBXnXfMlQEKq/ZKNckGvGFcLeFeao56H0Rj2X81jhH9nqD PhALQIKj2xBf/+y3hMsatoABFqj2dJrmjfTeciBg4DdAtXDIY2sS4zBXdPJE3B/jJgQf SvbQIGMuAgGW2bL038Z487Y+mTZCrCH9o8E1uZvRHPLAcnwiJyOHgWXZ9US0/oofoVWx eSaXZM6qkaSGocWFPV1Ta4+UToq+Z95FcjiDBe4EHCy0WvArJOjO+MAa2/TIRBO6eIZK jpt6fJhbhJQ/3AkhvGeYetRWVX+NpRoIvOxhy6jjCrp0FwWQDCrwg03YlWnHDqQxmOPx bbJg== MIME-Version: 1.0 Received: by 10.50.140.106 with SMTP id rf10mr19673260igb.36.1331245579761; Thu, 08 Mar 2012 14:26:19 -0800 (PST) Sender: gildor478@gmail.com Received: by 10.42.169.135 with HTTP; Thu, 8 Mar 2012 14:26:19 -0800 (PST) In-Reply-To: References: <1991A512A37E49ACA5AAD30A38D628BF@erratique.ch> Date: Thu, 8 Mar 2012 23:26:19 +0100 X-Google-Sender-Auth: 5wj98kMFrF5mDE2vJxL-ml9c0es Message-ID: From: Sylvain Le Gall To: Adrien Cc: =?ISO-8859-1?Q?Daniel_B=FCnzli?= , caml-list@inria.fr Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by walapai.inria.fr id q28MQQuW005805 Subject: Re: [Caml-list] Re: oasis packaging questions Hi, 2012/3/8 Adrien : > Hi, > > On 08/03/2012, Sylvain Le Gall wrote: >> Hi, >> >> 2012/3/8 Daniel Bünzli : >>> Le jeudi, 8 mars 2012 ŕ 09:31, Sylvain Le Gall a écrit : >>>> setup.ml will be enough for me ;-) But I am biased. >>> >>> For distribution, I'm fine with that aswell. For developement setup.ml >>> takes too much time to invoke (adds an overhead of 0.5s on my system). >>> >> >> That the parsing time because the file is big. I know this issue and >> will try to improve that in the future. I think a 50% down size is >> possible, that will bring this time to 250ms. Although, I don't think >> that even for development env a 500ms delay is that big... I doubt to >> be able to reduce to ~0s. > > For my own stuff, I've been using a Makefile which includes a rule to > (re)compile setup.ml into an executable with ocamlc.opt (compiling > with ocamlopt was too slow). My usual development machine isn't > terribly fast and this has helped a lot. > > I think there was a mention of an issue though but it can help a lot. Make sense. So super quick hack! Add at the beginning of setup.ml: let () = let setup_ml = Sys.argv.(0) in (* Check we are running the script with ocaml, not the compiled mode *) if Filename.check_suffix setup_ml ".ml" then begin let setup_base = Filename.chop_extension setup_ml in let setup_digest = setup_base ^ ".digest" in let setup_exe = Filename.concat Filename.current_dir_name (setup_base ^ (if Sys.os_type = "Win32" then ".exe" else "")) in let self_digest = let chn = open_in setup_ml in let digest = Digest.channel chn (in_channel_length chn) in close_in chn; digest in let pre_digest = try let chn = open_in setup_digest in let digest = Digest.input chn in close_in chn; digest with _ -> Digest.string "" in let clean ?(all=false) () = List.iter (fun fn -> try Sys.remove fn with _ -> ()) ( (if all then [setup_exe; setup_digest] else []) @ [setup_base ^ ".cmi"; setup_base ^ ".cmo"] ) in if not (Sys.file_exists setup_exe) || self_digest <> pre_digest then begin match Sys.command "ocamlfind ocamlc -o setup setup.ml" with | 0 -> (* Compilation succeed, update the digest *) let chn = open_out setup_digest in Digest.output chn self_digest; close_out chn; clean () | _ -> prerr_endline "E: Compilation of setup.ml doesn't succeed."; clean ~all:true () end; if Sys.file_exists setup_exe then begin print_endline "I: Running the compiled version of setup.ml"; exit (Sys.command (String.concat " " (List.map Filename.quote (setup_exe :: (List.tl (Array.to_list Sys.argv)))))) end end Running time: without the hack -> 500ms with hack 1st run -> 268ms with hack 2nd run -> 110ms Do you think it make sense to include this at the beginning of setup.ml ? Cheers Sylvain