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

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

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