Version française
Home     About     Download     Resources     Contact us    
Browse thread
ackermann test
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] ackermann test
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