Jerry Coffin said:
(e-mail address removed) (Dez Akin) wrote in message
[ ... ]
Optimizers are getting smarter though, and I suspect in not too many
years it will be a waste of time to attempt to out-do the optimizer.
In a couple of decades at the most I suspect it will be impossible for
any human to outperform an optimizer. (Massalin's superoptimizer led
to Denali, which I imagine will lead to more generic optimal code
approximators)
Hmm...an interesting proposition. I've been hearing variations on
this theme since (at least) the FORTRAN IV days.
If anything, it looks to me like thie situation is getting worse: I
don't think I've looked at anything in the last 5 years that was
nearly AS CLOSE to optimal as Control Data's FORTRAN IV compiler
typically produced 20+ years ago!
Programming languages have evolved a bit since FORTRAN IV. If all
we had was still FORTRAN IV, I'm convinced that almost no-one would
be able to write assembly code outperforming the output from a
modern FORTRAN IV compiler.
The programming language FORTRAN was designed with one goal being the
highest priority: to produce efficient machine code. When John
Backus implemented the FORTRAN I compiler back in 1957, programmers
were skeptical of high-level languages in general -- they were
usually convinced that the efficiency of the generated code would be
terrible or, at best, bad. Remember that at this time, computer were,
by today's standards, extremely slow. In addition, computer time did
cost a lot of money, perhaps half-a-dollar for every CPU second or
so. Therefore efficient programs were of a very high priority;
in comparison, programmer time was cheap.
FORTRAN I did succeed in producing code almost as efficient as
hand-written code by a skilled programmer, and as a result high-level
languages got accepted. Later, when computers got more powerful and
CPU time got much cheaper, the priorities changed: when the
programmer time got more expensive than the CPU time, it became
sensible to design high-level languages to ease program development
rather than to produce efficient machine code.
Therefore the situation is probably "worse" today: the code
produced by, say, a Java compiler is definitely much less
efficient than the code produced by a FORTRAN IV compiler.
But OTOH the complex programs written in today's HLL's could
never reasonably have been implemented in FORTRAN IV, a
language which even lacks recursion.
Finally, if your program includes some text processing (which
virtually every modern program does to some extent), FORTRAN IV would
be a hopeless language to use, since it lacks string variables. To
do text processing in FORTRAN IV, you must put text in numerical
variables, and keep track of how many characters fits in a machine
word. And to port such a program from a computer where, say, 4
character fits in a word to another computer where, say, 10
characters fits in a word would be a nightmare if the program does
non-trivial text processing. In such a case it's highly likely that
the text processing parts of the FORTRAN IV program will produce code
with bad efficiency.
Part of this may be that I've gotten better at writing assembly
language, but frankly I rather doubt it -- I doubt that the extra
experience has compensated for the simple fact that I don't write
assembly code nearly as often anymore.
--