Browse thread
ackermann test
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Oliver Bandel <oliver@f...> |
| Subject: | Re: [Caml-list] ackermann test |
On Wed, Feb 09, 2005 at 10:26:39AM +0100, Marcin 'Qrczak' Kowalczyk wrote:
> skaller <skaller@users.sourceforge.net> writes:
>
> >> Where can I find the C code you are using?
> >
> > int ack(int x, int y) {
> > return x==0? y+1: (y==0? ack(x-1,1):ack(x-1,ack(x,y-1)));
> > }
>
> If you write it like this:
>
> 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).
So we can compare, what reults will yielded by that different code
on the same platform for which we saw the other benchmark values.
Ciao,
Oliver