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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by sympa.inria.fr (Postfix) with ESMTPS id 434E4820A1 for ; Fri, 6 Sep 2013 10:50:14 +0200 (CEST) Received-SPF: None (mail2-smtp-roc.national.inria.fr: no sender authenticity information available from domain of gabriel.scherer@gmail.com) identity=pra; client-ip=209.85.214.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail2-smtp-roc.national.inria.fr: domain of gabriel.scherer@gmail.com designates 209.85.214.41 as permitted sender) identity=mailfrom; client-ip=209.85.214.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="gabriel.scherer@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-bk0-f41.google.com) identity=helo; client-ip=209.85.214.41; receiver=mail2-smtp-roc.national.inria.fr; envelope-from="gabriel.scherer@gmail.com"; x-sender="postmaster@mail-bk0-f41.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlcDANyVKVLRVdYpk2dsb2JhbABbgzxRgWKtLJJEgRoIFg4BAQEBBwsLCRQEJIIkAQEFQAEbEgsBAwwGBQcEDQ0hIgERAQUBChIGExKHXQEDDwyfMoxQgwWEIgoZJwMKZIgzAQUMj2YHhB0Dl3WBL45OGCmESjo X-IPAS-Result: AlcDANyVKVLRVdYpk2dsb2JhbABbgzxRgWKtLJJEgRoIFg4BAQEBBwsLCRQEJIIkAQEFQAEbEgsBAwwGBQcEDQ0hIgERAQUBChIGExKHXQEDDwyfMoxQgwWEIgoZJwMKZIgzAQUMj2YHhB0Dl3WBL45OGCmESjo X-IronPort-AV: E=Sophos;i="4.90,853,1371074400"; d="scan'208";a="31750815" Received: from mail-bk0-f41.google.com ([209.85.214.41]) by mail2-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 06 Sep 2013 10:50:13 +0200 Received: by mail-bk0-f41.google.com with SMTP id na10so1208254bkb.28 for ; Fri, 06 Sep 2013 01:50:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=1GrRzazcW3BlImBz5ZQa2/2uoTrLVYXczf5PL+UqDOo=; b=VVq4MMPjTs+zRtNugTU6lg631jE6R9Tf55hW0QZ5Ja2aZY2hmoHSZLjzVpd6W/Ex+X FHb4x4oBGPlG8M8IBGGiUpKmjU8iQQJpgEO8SP4X61FsiCzHp4NNyOeIn7kuzAbLw0d2 Byqh1sBCq5Yof6nPIM0aPt9NfxgdeItwzwm3c+6rIR1WIadebNB8EL3QsCHf/SjlVX69 fDKHVIz9Q7822ZiKhnABHqAE+kbJ3Q4N+eTS4mY4if9MmVoPoF4s3nATz979sPhEpY0f f9MqaWeLgk4WLXed1Iigo0eyZ8pWZzLNXjSfVweNAdYlkV51BomtWwDd6youP0FoA836 gdCQ== X-Received: by 10.205.20.5 with SMTP id qm5mr479236bkb.46.1378457413055; Fri, 06 Sep 2013 01:50:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.204.236.193 with HTTP; Fri, 6 Sep 2013 01:49:32 -0700 (PDT) In-Reply-To: <5229923B.6090404@coherentgraphics.co.uk> References: <52293459.9060707@riken.jp> <5229923B.6090404@coherentgraphics.co.uk> From: Gabriel Scherer Date: Fri, 6 Sep 2013 10:49:32 +0200 Message-ID: To: John Whitington Cc: Francois Berenger , OCaml Mailing List Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] an OCaml program profile I have found the "poor man profiler" approach to work well when you want to know not only which functions calls some slow runtime function the most, but only in which situation (it depends on the callstack and not only the source location). Ygrek's pmpa script is very helpful for that http://ygrek.org.ua/p/code/pmpa On Fri, Sep 6, 2013 at 10:28 AM, John Whitington wrote: > Hi, > > > Francois Berenger wrote: >> >> Hello, >> >> I am running experiments with a program. >> I'd like the program to run faster because >> it would reduce experiments round-trip. >> >> Here is the top of the profile: >> --- >> Flat profile: >> >> Each sample counts as 0.01 seconds. >> % cumulative self self total >> time seconds seconds calls s/call s/call name >> 58.07 132.13 132.13 161527987 0.00 0.00 caml_fl_allocate >> 21.13 180.21 48.08 2339 0.02 0.02 caml_fl_add_blocks >> 4.87 191.30 11.09 5497 0.00 0.00 mark_slice >> 1.65 195.06 3.76 979591485 0.00 0.00 caml_page_table_lookup >> 1.50 198.47 3.41 5620 0.00 0.00 sweep_slice >> 1.20 201.21 2.74 186584504 0.00 0.00 caml_oldify_one >> 1.04 203.57 2.36 134849325 0.00 0.00 compare_val >> 1.02 205.89 2.32 290049921 0.00 0.00 caml_float_compare >> 0.80 207.71 1.82 123048730 0.00 0.00 caml_hash >> 0.76 209.44 1.73 161525648 0.00 0.00 caml_alloc_shr >> --- >> >> I think the program spends most of its time doing garbage >> collection. >> >> How can I make it go faster? > > > Look further down the profile in the individual numbered sections for each > function. The section for "caml_call_gc" usually provides the most useful > start. > > For example, if most calls to caml_call_gc are from List.rev, look at calls > to that etc. It's not entirely straightforward, but after a bit of following > numbers around the file, you'll get used to it. > > Thanks, > > -- > John Whitington > Director, Coherent Graphics Ltd > http://www.coherentpdf.com/ > > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs