From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 6D10FBC32 for ; Thu, 17 Mar 2005 11:31:01 +0100 (CET) Received: from ptb-relay01.plus.net (ptb-relay01.plus.net [212.159.14.212]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j2HAV0TK003776 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Thu, 17 Mar 2005 11:31:01 +0100 Received: from [80.229.56.224] (helo=chetara) by ptb-relay01.plus.net with esmtp (Exim) id 1DBsHK-000G7J-PT for caml-list@yquem.inria.fr; Thu, 17 Mar 2005 10:30:58 +0000 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] OCaml troll on Slashdot Date: Thu, 17 Mar 2005 10:31:59 +0000 User-Agent: KMail/1.7.1 References: <20050316001819.GB347@first.in-berlin.de> <200503161951.48923.jon@ffconsultancy.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200503171031.59483.jon@ffconsultancy.com> X-Miltered: at concorde with ID 42395C64.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 recursive:01 compilation:01 ocamlopt:01 recursion:01 native-code:01 ocamlopt:01 ocaml:01 ...:98 frog:98 wrote:01 tail:01 tail:01 slower:01 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: On Thursday 17 March 2005 03:35, brogoff wrote: > I just ran your counterexample and the tail recursive code was faster > for each. I used native code compilation. That's odd. My previous results were for a 1.2GHz Athlon t-bird, ocamlopt 3.08. Tail recursion is also significantly slower on an 866MHz P3 (x86 native-code) with ocamlopt 3.07: Non-tail-recursive took: 0.873906s Tail-recursive took: 1.005320s Non-tail-recursive took: 4.288313s Tail-recursive took: 0.986330s And on an Athlon MP 2600+ with ocamlopt 3.06: Non-tail-recursive took: 0.289890s Tail-recursive took: 0.332338s Non-tail-recursive took: 1.981812s Tail-recursive took: 0.332071s This may be a cache effect as these CPUs all have 256kb cache. Perhaps if you try a smaller/larger problem depending on your cache size... -- Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists