On Mon, Aug 25, 2003 at 06:56:15AM +0900, Martin Weber wrote:

> > on those systems I tried (x86, m68k) the ocaml version is faster.
> > The margin is small but I am still surprised something is faster
> > than gcc :)
> 
> You talk as if gcc was a good compiler :) just try the bloated 3.3
> against intel's compiler on x86 or the fine 2.95 on the x86 against
> the intel compiler and you'll approach what is a good compiler (at
> least on x86). Yes I know gcc is portable (and thus fine) but it's
> basically the worst-choice-common-denominator you have available for
> most platforms...

just for the record, the speed diff is due to use of registers for
parameter passing. Using  __attribute__ ((regparm(...))) in gcc
yields exactly same speed for this simple example, but generally
strictly typed languages (which plain 'c' isnt) will allways win
because they don't need to take into account broken fn declarations.

Btw can you send me 686-linux-elf -O3 -fomit-frame-pointer output of
Intel-cc of this code?

int  __attribute__ ((regparm(3))) fib (int x) 
{
  if (x<2) return 1;
  return fib(x-1)+fib(x-2);
}

main(int argc, char **argv)
{
  int x;

  if (argc!=2){
    printf("requires integer argument\n");
    exit(2);
  }
  x=atoi(argv[1]);
  printf("fib(%d)=%d\n",x,fib(x));
}