TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: CAREY BLOODWORTH
from: HERMAN SCHONFELD
date: 1997-04-09 16:19:00
subject: DJGPP OPTIMIZATIONS

HS>CB>GCC is not the best at optimization.  Plus, it only generates 486
CB>code,
HS>CB>not 586+ code.  Plus, the 486 code tweaking it does is for a
CB>_generic_
HS>I don't see how using pentium opcodes would improve performance.
CB>There aren'
CB>It's not a matter of Pentium opcodes.  It's a matter of arranging the
CB>opcodes properly, in order to take advantage of the multiple execution
CB>units, and to take advantage of instruction timing of the Pentium.
CB>Programs tuned to the Pentium can have up to 50% higher performance.
CB>Your milage may vary, of course, but 10-20% would not be unreasonable.
CB>And what's more... Code tuned in the 'Pentium way' will also often run
CB>faster on most 486s, too!  This is because 1) many 486 level optimizors
CB>aren't that great, 2) many of the modern 486 class CPUs are better than
CB>the generic 486 (ie: Intel 486) that they are tuned for.
CB>Take a look at the differences djgpp generates between the normal 386
CB>code mode, and optimized for the 486.  Same opcodes, but since the 486
CB>has different timings for the instructions, different arrangements
CB>(producing the same results) can be faster.  (Or, if you want an even
CB>more drastic example, consider normal x86 opcodes but compare the
CB>timings ratios between an 8086 and a typical 486.  Although a 486's
CB>instructions will be faster, other 'pattern's will be faster.  On the
CB>8086, string instructions and the LOOP instruction were faster than what
CB>they replaced.  On a 486, doing the individual instructions yourself is
CB>usually faster than the 'combined' instruction.)
CB>For the Pentium, it has two execution units.  You can run some pairs of
CB>instructions simultaneously, while others have to be done sequentially.
CB>So, obviously, good instruction pairing will allow both execution units
CB>to run at the same time, reducing the running time.
CB>Take a look at your own code with and without the -m486 option.  There
CB>are no useful instructions added to the 486 (or the Pentium), so you are
CB>dealing with plain 386 type code.  The difference lies in the fact that
CB>the 486 executes the instructions with different cycle counts.  So,
CB>keeping that in mind lets the compiler generate code that is tuned to
CB>the way a 486 behaves, but would still run on a 386 or a Pentium.
Thats getting pretty specific, not all machines would re-act the same way.
... Do device drivers need a chauffeur's license?
--- Ezycom V1.48g0 01fd016b
---------------
* Origin: Fox's Lair BBS Bris Aus +61-7-38033908 V34+ Node 2 (3:640/238)

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™.