[comp.lang.misc] optimization

preston@titan.rice.edu (Preston Briggs) (02/08/90)

In article <RAULMILL.90Feb7094338@alcor.usc.edu> raulmill@usc.edu (R D R) writes:
>Preston Briggs writes:
>;> I'm still hoping to see somebody recode matrix multiply in C, using 
>;> all the source hacks they want, so we can compare it to what we get
>;> using Fortran and our (not mine, friends') latest transformations.

>While we're on the topics of recoding, and how well source code maps
>onto a machine, why not consider a few other mainstream languages
>besides C and Fortran??????

>On the other hand, there are languages like APL which with a few
>changes (like variable scoping, and function rank declaration) ought
>to make very nice compiling languages.  /* APL implementation of
>matrix multiply:  A <- B +.x C */.  From what I've heard, it is
>possible to DEVELOP code in APL about 6 or 7 times faster than what is
>usual with FORTRAN.  (Weren't the two big advantages of FORTRAN over c
>supposed to be that FORTRAN is faster to write, and FORTRAN allows
>more optimizations in compilation, especially as machine architectures
>change???)

If people want to hack up matrix multiply in other languages, I don't mind.
On the other hand, I probably won't be able to run most of them.
(C++ might be doable).

I got into this discussion when someone suggested that C was just
as "optimizable" as Fortran.  I disagree.  Fortran has some
restrictions chosen deliberately to allow greater optimization;
C avoided those restrictions.  In particular, someone said that
Fortran's "no aliasing" restriction (assignments to aliased parameters
aren't allowed) didn't help optimization except when searching for
parallelization.  He challenged people to produce well-written code
where the aliasing restriction helped optimization.

Since I've been working on a Fortran compiler, I thought it would be easy to 
supply examples.  After all, we have lots of test cases.  Unfortunately,
these weren't accepted as well-written, presumably because they weren't
written in C.  So, I thought it would be cool for a C jock to provide
a well-written example.  Then we'd stomp it:->

About APL...

People at Rice were at one point interested in compiling APL,
hoping to get lots of vector bang.  Unfortunately, it seemed
that even given compilation and a vector processor, there was
still enough overhead in manipulating array bounds and such
that they were discouraged.  Basically, they weren't able to
keep the vector units very busy.

However, there is a book by Tim Budd called "An APL Compiler".
Published by Springer-Verlag, I believe.  The answers are probably
in there.

Preston Briggs
preston@titan.rice.edu