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 ED3707EC41 for ; Thu, 25 Oct 2012 08:48:58 +0200 (CEST) Received-SPF: None (mail1-smtp-roc.national.inria.fr: no sender authenticity information available from domain of david.mentre@gmail.com) identity=pra; client-ip=209.85.216.47; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="david.mentre@gmail.com"; x-sender="david.mentre@gmail.com"; x-conformance=sidf_compatible Received-SPF: Pass (mail1-smtp-roc.national.inria.fr: domain of david.mentre@gmail.com designates 209.85.216.47 as permitted sender) identity=mailfrom; client-ip=209.85.216.47; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="david.mentre@gmail.com"; x-sender="david.mentre@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-qa0-f47.google.com) identity=helo; client-ip=209.85.216.47; receiver=mail1-smtp-roc.national.inria.fr; envelope-from="david.mentre@gmail.com"; x-sender="postmaster@mail-qa0-f47.google.com"; x-conformance=sidf_compatible X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AqABAAngiFDRVdgvk2dsb2JhbABEhU0BvEsIIwEBAQEJCQsJFAQjgh4BAQEDARICLAE4AQMBCwEFBQs7HwMSAQUBHAYTIodQAwkGnhRgCQOPHoUVJw2JTgEFDJJCA40riEiOWBYpgViCOw X-IronPort-AV: E=Sophos;i="4.80,645,1344204000"; d="scan'208";a="178833713" Received: from mail-qa0-f47.google.com ([209.85.216.47]) by mail1-smtp-roc.national.inria.fr with ESMTP/TLS/RC4-SHA; 25 Oct 2012 08:48:58 +0200 Received: by mail-qa0-f47.google.com with SMTP id i29so4345138qaf.6 for ; Wed, 24 Oct 2012 23:48:56 -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:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type; bh=jFH2BXS2APrH3d6CcsmlXYqWdlyXrlrP+itqsieF+z8=; b=lgvn1gg5cxi2o1nK50HoC8i4ckBPTaO1Wi8W0DI4XDeCafuAXe2Vw+5ZeBva5evCWx 3x5lGIgofVBCjk7nkfDSxHKk091mZ4f0IvbPnucrm65hlWvT2J29F4PMdQl7dX83t5kg 5eLBSgiTbxWaChvdBR0AaqXyLo0Q/YcTnuTowj8Q5qzaaknr3dYJXejtxE09zsis9cKi m1SVILIn/JmSkAGLJQrbo6HPQl/TSN2FF9VGyn7a4OPyGHh7e48vTjeuI3VjHOzSkKzi h0VKSZbk0HBNTzwV1nwXKOrBmpgXhY7ltPch6qsUlYHfF23l1/KCi9l/G5TE2kTVHS5j iwqQ== Received: by 10.224.208.68 with SMTP id gb4mr7187630qab.99.1351147736311; Wed, 24 Oct 2012 23:48:56 -0700 (PDT) MIME-Version: 1.0 Sender: david.mentre@gmail.com Received: by 10.49.120.225 with HTTP; Wed, 24 Oct 2012 23:48:26 -0700 (PDT) In-Reply-To: <1351094817.12207.11@samsung> References: <1351094817.12207.11@samsung> From: David MENTRE Date: Thu, 25 Oct 2012 08:48:26 +0200 X-Google-Sender-Auth: -kqbQc6ehVp29DnaTzyxX0crGOU Message-ID: To: Gerd Stolpmann Cc: Oliver Bandel , caml users Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [Caml-list] Behaviour of an OCaml program: any possible GC improvement? Hello Gerd, 2012/10/24 Gerd Stolpmann : > I've seen high CPU for garbage collection frequently for mainly functional > programs. It's their nature - you generate lots of short-living intermediate > results. You can change that only by changing the algorithm, e.g. by caching > results that would otherwise be recomputed again. That was my feeling. I just wanted to check easy parts before digging into more complex algorithm change. > Some improvement is also > possible with simple tricks, e.g. if you have something like > > Number 0 > > where Number is from an algebraic type, and you use this term frequently, > consider to add a constant for it, > > let n0 = Number 0 > > so this isn't reallocated all the time Thanks for the trick. Best regards, david