TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: DARIN MCBRIDE
from: JERRY COFFIN
date: 1997-04-22 11:12:00
subject: DJGPP OPTIMIZATIONS

On (20 Apr 97) Darin McBride wrote to Herman Schonfeld...
 HS> Lets see now, where did I say that a compiler doesn't optimize?
 HS> Does a compiler change a *256 to a <<8?
 DM> Actually, it does.
 HS> Obviously not, so why not optimize it yourself?
 DM> You "obviously" are wrong, so why not admit it?
[ demo code elided ]
With that, I'm going to ask that this thread be wound down.  Ultimately,
this is all heavily dependent on the compiler you happen to use - some
happen to do this optimization, others don't.  If you use one that
doesn't on its own, doing the optimization manually is perfectly
reasoanble, and while it certainly hurts readabiliy a little, most
people who work with VGA mode 13h graphics recognize the equivalence of
`y<<6+y<<8' and `y*320', very easily, so the detriment to readability is
minor at most.  Likewise the difference in speed depends heavily on the
exact CPU used to run the code.
The object code you get depends as much (if not more) on the compiler
you use as on the source code you feed it, and 2) the object code that's
optimum depends heavily on the CPU with which measurements are done
anyway.
In short, there's no general answer, and nearly all the arguments going
on are at cross-purposes to each other.
    Later,
    Jerry. (C_PLUSPLUS Moderator)
... 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™.