Related articles |
---|
[7 earlier articles] |
Re: Why C is much slower than Fortran reid@micro.ti.com (Reid Tatge) (1999-05-20) |
Re: Why C is much slower than Fortran jhallen@world.std.com (1999-05-29) |
Re: Why C is much slower than Fortran hwstock@wizard.com (H.W. Stockman) (1999-06-02) |
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) |
From: | djb@koobera.math.uic.edu (D. J. Bernstein) |
Newsgroups: | comp.lang.c++,comp.compilers |
Date: | 2 Jun 1999 01:44:42 -0400 |
Organization: | IR |
References: | <3710584B.1C0F05F5@hotmail.com> 99-05-011 99-05-037 99-05-057 |
Keywords: | performance |
George Neuner <gneuner@dyn.com> wrote:
> The way to get the most out of your compiler is to write simple, clear
> code and not use clever tricks.
Can you say ``five times slower''?
That's gcc's Pentium performance on a simple, clear, straightforward
inner loop---
long double t0,t1,t2,t3,t4,t7;
int *buf;
...
for (i = -96;i < 0;++i) {
t7 = buf[i];
t0 += doublearray[0][i + 96] * t7;
t1 += doublearray[1][i + 96] * t7;
t2 += doublearray[2][i + 96] * t7;
t3 += doublearray[3][i + 96] * t7;
t4 += doublearray[4][i + 96] * t7;
}
---compared to what I get _for exactly the same computation_ by writing
more complicated code.
See http://pobox.com/~djb/hash127/install.html for the complete program.
Try compiling and running ./speed; then try again with x86-idea in
conf-opt and with your favorite Pentium compiler in conf-cc.
> As John said, the language specification is a contract.
Well, yes, we all expect the compiler to behave as documented. But the
documented behavior is inadequate. Saying ``yes, but it's documented''
is missing the point.
---Dan
Return to the
comp.compilers page.
Search the
comp.compilers archives again.