From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id CA640BC88 for ; Wed, 9 Feb 2005 14:34:57 +0100 (CET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j19DYten013481 for ; Wed, 9 Feb 2005 14:34:57 +0100 Received: from [192.168.1.200] (ppp212-197.lns2.syd3.internode.on.net [203.122.212.197]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id j19DYbjQ002981; Thu, 10 Feb 2005 00:04:48 +1030 (CST) Subject: Re: [Caml-list] ackermann test From: skaller Reply-To: skaller@users.sourceforge.net To: Oliver Bandel Cc: caml-list@yquem.inria.fr In-Reply-To: <20050209111730.GB449@first.in-berlin.de> References: <1107921472.5022.410.camel@pelican.wigram> <877e9a170502082009591db0b4@mail.gmail.com> <1107922403.5022.426.camel@pelican.wigram> <87vf92qe28.fsf@qrnik.zagroda> <20050209111730.GB449@first.in-berlin.de> Content-Type: text/plain Organization: Message-Id: <1107956075.5022.593.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 10 Feb 2005 00:34:36 +1100 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 420A117F.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ackermann:01 sourceforge:01 oliver:01 bandel:01 wrote:01 gcc:01 -static:01 hacked:01 ocamlopt:01 stack:01 stack:01 pointer:01 glebe:01 061:98 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 Wed, 2005-02-09 at 22:17, Oliver Bandel wrote: > > int ack(int x, int y) { > > if (x==0) return y+1; > > if (y==0) return ack(x-1,1); > > return ack(x-1,ack(x,y-1)); > > } > > > > then gcc-3.4.3 generates better code (optimizes tail calls). > > -fomit-frame-pointer further speeds it up. > > Would be nice to have the comlete benchmark again - now with this > code (or with an added row for this C-Code). I only have gcc 3.2.2. With -fomit-frame-pointer and -O3 and -static for the new C: new C w/o old C new Felix old Felix HACKED Ocamlopt Ocamlb y=10 0.5 0.8 1.8 2.9 7 10 0.4 12 y=11 7.4 12.5 16 28 55 75 2 50 y=12 64 98 113 180 290 370 9 220 w/o -- new C code without -fomit-frame-pointer 'old Felix' + 2 ints on stack frame 'HACKED' + 4 ints on stack frame Felix puts at least 2 extra words on the stack, probably 3, plus possibly g++ is saving the 'this' pointer which is a 4 word overhead compared to the C code. -- John Skaller, mailto:skaller@users.sf.net voice: 061-2-9660-0850, snail: PO BOX 401 Glebe NSW 2037 Australia Checkout the Felix programming language http://felix.sf.net