From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@sympa.inria.fr Delivered-To: caml-list@sympa.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by sympa.inria.fr (Postfix) with ESMTPS id 5708B7ED7A for ; Sun, 26 Aug 2012 22:26:10 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of bobzhang1988@gmail.com) identity=pra; client-ip=209.85.216.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of bobzhang1988@gmail.com designates 209.85.216.182 as permitted sender) identity=mailfrom; client-ip=209.85.216.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="bobzhang1988@gmail.com"; x-conformance=sidf_compatible; x-record-type="v=spf1" Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of postmaster@mail-qc0-f182.google.com) identity=helo; client-ip=209.85.216.182; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="bobzhang1988@gmail.com"; x-sender="postmaster@mail-qc0-f182.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah4DADqGOlDRVdi2k2dsb2JhbABFqQqRWQgiAQEBAQkJFBQEI4IgAQEBBBICLAEbEgsBAwwGBQsNCQQaBw8CEAIRAQUBCgERBg0BBQIBAQ4Qh1sBAwwLnGkJA4wignOELwoZJwMKV4hxAQUMihljJ4ZqA5QCgVOBFIl6gyk+hB+BPg X-IronPort-AV: E=Sophos;i="4.80,316,1344204000"; d="scan'208,217";a="170859807" Received: from mail-qc0-f182.google.com ([209.85.216.182]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 26 Aug 2012 22:25:45 +0200 Received: by qcsg15 with SMTP id g15so3492628qcs.27 for ; Sun, 26 Aug 2012 13:25:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; bh=T0cAZUTrTMvv8vUIGoGxFgNLdwOSzTExqcUS4mHXlMc=; b=xMocBIx8YUKJ0F+tw9GSaeatY6x0nuZ8Juld+bQ6d5b3hosa51Eri5pxaZsRco+OZG fk/X6xwG29n4T0mBHnbiXAfd0sNjem86oHmwtengEOIh+ZuPGddhNwCczyKG6bPrI86M 9caSsdKLVx/EAriZvlCJMnpk9jq9yFJ4NralW1XoxsJ8wrmtvKCttG/kE6TIYvx3g147 xeZ+saTIn/UEMXihce/CxQi2UNVqeD1naFJPh4yjjS0DxAPGaboakiMO01tJVYKw4/d9 ZYbQTorr92J0+PmJAbePTEudJJYKoSyTInAhd60uHmw9BhWtbbpPHvKmqJCB0ARUNx3p 9T4g== Received: by 10.224.178.133 with SMTP id bm5mr20578957qab.1.1346012744589; Sun, 26 Aug 2012 13:25:44 -0700 (PDT) Received: from Hongbos-MacBook-Air.local ([66.250.143.158]) by mx.google.com with ESMTPS id gs8sm4544875qab.10.2012.08.26.13.25.42 (version=SSLv3 cipher=OTHER); Sun, 26 Aug 2012 13:25:43 -0700 (PDT) Message-ID: <503A8648.90804@gmail.com> Date: Sun, 26 Aug 2012 16:25:44 -0400 From: Hongbo Zhang User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Gabriel Scherer CC: Caml List References: <503A30A7.3030707@gmail.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------020106050005060402080701" Subject: Re: [Caml-list] How to profile compiler's performance This is a multi-part message in MIME format. --------------020106050005060402080701 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 8/26/12 11:05 AM, Gabriel Scherer wrote: Hi Gabriel, Sorry for the noise, it turns out that I upgraded my ocalmfind, and forget to modify findlib.conf. ocamlfind still picks 'ocamlc' instead of 'ocamlc.opt'. There's a huge performance difference(10x) between ocamlc.opt and ocamlc. Thanks! > You could try compiling a native OCaml compiler executable with > profiling option (-p) (setting that up might be a pain, though). > > Before that you could try to only typecheck the file (option "-i") to > know whether it's the type-checking or code generation that is > problematic. (-i causes type printing as well, so for very large types > that are internally shared it can be its own source of slowness) > > If it was in code generation, that would most likely only occur during > when compiling to native code. Have you noticed the performance > bottleneck with compilation to bytecode as well? > > (Of course using the natively-compiled versions of your compilers will > also speed up performance, but if your generated code hits one of the > source of exponential behavior of the compiler you're out of luck anyway.) > > On Sun, Aug 26, 2012 at 4:20 PM, Hongbo Zhang > wrote: > > Hi List, > I have a file which is only 410 lines, the compilation process > takes nearly 1 minutes. Before my refactoring, it's compiled very > fast. > Is there a way to know which part the compiler spend most time in ? > Many Thanks > > -- > 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 > > --------------020106050005060402080701 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit
On 8/26/12 11:05 AM, Gabriel Scherer wrote:
Hi Gabriel,
  Sorry for the noise, it turns out that I upgraded my ocalmfind, and forget to modify findlib.conf.
ocamlfind still picks 'ocamlc' instead of 'ocamlc.opt'.
  There's a huge performance difference(10x) between ocamlc.opt and ocamlc.
Thanks!
You could try compiling a native OCaml compiler executable with profiling option (-p) (setting that up might be a pain, though).

Before that you could try to only typecheck the file (option "-i") to know whether it's the type-checking or code generation that is problematic. (-i causes type printing as well, so for very large types that are internally shared it can be its own source of slowness)

If it was in code generation, that would most likely only occur during when compiling to native code. Have you noticed the performance bottleneck with compilation to bytecode as well?

(Of course using the natively-compiled versions of your compilers will also speed up performance, but if your generated code hits one of the source of exponential behavior of the compiler you're out of luck anyway.)

On Sun, Aug 26, 2012 at 4:20 PM, Hongbo Zhang <bobzhang1988@gmail.com> wrote:
Hi List,
   I have a file which is only 410 lines, the compilation process takes nearly 1 minutes. Before my refactoring, it's compiled very fast.
   Is there a way to know which part the compiler spend most time in ?
   Many Thanks

--
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



--------------020106050005060402080701--