Re: Why C is much slower than Fortran

jhallen@world.std.com (Joseph H Allen)
29 May 1999 01:06:41 -0400

          From comp.compilers

Related articles
[2 earlier articles]
Re: Why C is much slower than Fortran sokal@holyrood.ed.ac.uk (Daniel Barker) (1999-04-30)
Re: Why C is much slower than Fortran harley@corton.inria.fr (Robert Harley) (1999-05-03)
Re: Why C is much slower than Fortran hrubin@stat.purdue.edu (1999-05-09)
Re: Why C is much slower than Fortran terryg@uswest.net (1999-05-16)
Re: Why C is much slower than Fortran gneuner@dyn.com (1999-05-16)
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)
Hardware doing the work (Was Re: Why C is much slower than Fortran) creedy@mitretek.org (Chris Reedy) (1999-06-02)
[8 later articles]
| List of all articles for this month |

From: jhallen@world.std.com (Joseph H Allen)
Newsgroups: comp.lang.c++,comp.compilers,comp.arch,comp.sys.intel
Date: 29 May 1999 01:06:41 -0400
Organization: The World Public Access UNIX, Brookline, MA
References: <3710584B.1C0F05F5@hotmail.com> 99-05-011 99-05-037 99-05-057
Keywords: design, Fortran, comment

We've been going over this argument for eons, with only two solutions
provided:


Fortran - generate fast, but possibly buggy code
C, C++ - generate correct, but slow code


The only true solution for the alias problem is going to come from hardware:


>Aliased values (the subject of this thread) cannot be cached in
>registers across function calls because the *real* value in memory
>might be changed without the cached value being changed.


This is where the problem needs to be fixed. The processor must know
the source address of the data in its registers. Each register should
snoop writes just as cache memory does. If your subfunction changes a
value which is aliased in a register, the register should be updated
or invalidated.


Unfortunately, this does not solve the most general alias problem (the
value in a register could be a derived value involving several source
memory addresses), and with pipelined superscaler processors with
register renaming this is not going to be easy to implement (just as
cache coherency issues in multi-processor systems are complex).


But what would be the speedup from this fix? If it's the same 50% to
100% speedup you get with using Fortran instead of C, I'd say that the
extra hardware would be worth it.
--
/* jhallen@world.std.com (192.74.137.5) */ /* Joseph H. Allen */
[Maybe or maybe not. This idea of registers that snoop on memory has been
proposed for a long time, but except maybe for the new IA64 nobody's ever
done it. -John]


Post a followup to this message

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