On 1 Dec 2010 at 14:45, Ian King wrote:
> I don't necessarily agree that assembler is required "to get full
> optimization of performance" today because of the work that's been
> done over the past three decades or so in compiler design. Modern
> compilers are written to take advantage of every trick available on
> the target platform such as load hoisting, redundant load/store
> elimination, loop unrolling, conditional execution and the like, over
> varying code scopes that aren't apparent across a project of a
> non-trivial size. Perhaps a really really good assembly language
> programmer could produce code a tiny bit faster than a reasonably
> well-written compiler could, but at what cost in development time?
On Wed, 1 Dec 2010, Chuck Guzis wrote:
I've seen where a good optimizing FORTRAN compiler
can do
substantially better than the run of the mill assembly programmer
simply because the compiler can cast a wider net (e.g. global
optimizations, register allocation, etc.), knows more tricks and
usually does a better job of instruction scheduling than the average
programmer.
Well, there's no question in my mind that
an excellent programmer can out-optimize a mediocre compiler, and
an excellent compiler can out-optimize a mediocre programmer.
Depending on their personal strengths would determine how well given
programmers would do relative to the compilers that they wrote.
Some things are fairly straightforward, but the maximum optimization
depends on an understanding of what the intent of a section of code is.
I remember some minor difficulties with the optimizations on Microsoft CF
5.0? (viewing and tampering with the keyboard buffer in BIOS RAM, rather
than using an INT21h function)
Microsoft fixed most of those with the next version, by adding in
the "volatile" keyword, and providing a manual over-ride on what portions
of the code were to be optimized.
It seems that every publisher's first attempt at creating an optimizing
compiler results in a new release that gives the user the power to turn
off local optimizations.
Of course, badly-written code in any language can
thwart even the
best compiler's efforts to generate good code.
. . . and somebody who writes a
lot of bad code can probably manage to
write even worse code with the help of a compiler.
--
Grumpy Ol' Fred cisin at
xenosoft.com