Re: Why C is much slower than Fortran

john@iastate.edu (John Hascall)
12 Jun 1999 21:28:15 -0400

          From comp.compilers

Related articles
[10 earlier articles]
Re: Why C is much slower than Fortran erik@arbat.com (Erik Corry) (1999-06-02)
Re: Why C is much slower than Fortran lindahl@pbm.com (1999-06-02)
Re: Why C is much slower than Fortran sokal@holyrood.ed.ac.uk (Daniel Barker) (1999-06-02)
Re: Why C is much slower than Fortran djb@koobera.math.uic.edu (1999-06-02)
Re: Why C is much slower than Fortran Peter.Mayne@compaq.com (Peter Mayne) (1999-06-03)
Re: Why C is much slower than Fortran lindahl@pbm.com (1999-06-06)
Re: Why C is much slower than Fortran john@iastate.edu (1999-06-12)
Re: Why C is much slower than Fortran erik@arbat.com (Erik Corry) (1999-06-14)
Re: Why C is much slower than Fortran jeff@jeff-jackson.com (Jeffrey Glen Jackson) (1999-06-19)
| List of all articles for this month |
From: john@iastate.edu (John Hascall)
Newsgroups: comp.lang.c++,comp.compilers,comp.arch
Date: 12 Jun 1999 21:28:15 -0400
Organization: Iowa State University, Ames, Iowa USA
References: <3710584B.1C0F05F5@hotmail.com> 99-05-057 99-05-142 99-06-005
Keywords: architecture, performance

Erik Corry <erik@arbat.com> wrote:
}> The only true solution for the alias problem is going to come from hardware:
}I saw a rather nice solution on Usenet a few years ago.
}All functions where optimisations are impossible due to C's liberal
}aliasing rules are automatically compiled in two versions, one where
}Fortran aliasing is assumed and one where it isn't. When you call the
}function the compiler calls the right one according to whether it can
}prove that arguments are unaliased. ...


}Has this been tried and failed?


      I wonder would it be sophisticated enough to tell the
      difference between something like this:


                void func(int * a, int * b, int n) {
                      int i;
                      for (i = 0; i < n; ++i) a[i] += b[i];
                }


      called with:


                a = malloc(100 * sizeof(int));
                b = malloc(100 * sizeof(int));
                      ...
                func(a, b, 100);


      and with:


                b = malloc(150 * sizeof(int));
                a = b + 50;
                func(a, b, 100);


John
--
John Hascall, Software Engr, Acropolis Project Manager, ISU Computation Center
http://www.cc.iastate.edu/staff/systems/john/index.html <=- the usual crud


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.