Node:Pentium,
Next:IO speed,
Previous:Older is faster,
Up:Performance
Q: Does DJGPP support Pentium-specific optimizations?
Q: I run the same program on a 486 and on a Pentium, and it's slower
on a Pentium!!
A: Beginning with version 2.95, GCC includes Pentium-specific
optimizations. Be sure to use the -mcpu=pentium
switch when
you optimize for Pentium or better CPUs.
A program might sometimes run slower on a Pentium due to alignment problems in DJGPP. GCC makes assumptions about how GAS (the assembler) handles alignment, but GAS from Binutils 2.8.1 and earlier was configured to treat alignment in a way that's different from what GCC assumes. The outcome of this is that longs are word-aligned, doubles are dword-aligned, etc. Depending on the DJGPP version, link order, library differences, you might get lucky (or unlucky) with a 50/50 chance to get an improper alignment. Different CPUs have different penalties for unaligned accesses, which may explain differences in speed.
DJGPP v2.01 had a bug in the startup code, whereby the runtime stack isn't aligned; this could also be a reason for slow-down, especially in programs compiled for Pentium.
You might consider adding some slack static variables to induce changes in alignment; if any of the changes suddenly cause a significant change in the runtime performance, then alignment might be the reason.
These alignment problems were finally solved in the DJGPP ports of Binutils 2.9.1 and GCC 2.95; so if you want to get rid of these problems, upgrade.