TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: HERMAN SCHONFELD
from: JERRY COFFIN
date: 1997-05-05 15:14:00
subject: LOW LEVEL OPTIMIZATIO 1/2

On (03 May 97) Herman Schonfeld wrote to Carey Bloodworth...
 CB>Unrolling can help.  Pointers slow it down.  I've timed it. 
 CB>Contrary to popular convention, pointers are _not_ automatically
 CB>faster than indexing.
 HS> Use an average consumer machine to test out your programs then come
 HS> back with results.
This generally has to do with the compiler, not the machine you run the
code on.  Nearly any decent compiler is written with the knowledge that
`A[b]' is exactly equivalent to `*(A+b)'.  It's easily shown that many
produce identical code regardless of the notation you happen to use in
the source code.  Some produce better code when you use array notation
than when you use pointer notation.  A few do the reverse.  However,
this is strictly a compiler question, not a hardware question.
 HS> With optimizations turned on, my compiler removes unused variables
 HS> from registers which can be used for something else.
If you feel it's good to screw up your programs to compensate for a
deficient compiler, great.  However, attacking the rest of the world
because they use working compilers so they can write readable code is
nonsensical.
    Later,
    Jerry.
... The Universe is a figment of its own imagination.
--- PPoint 1.90
---------------
* Origin: Point Pointedly Pointless (1:128/166.5)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.