www.delorie.com/djgpp/v2faq/faq114.html | search |
| Previous | Next | Up | Top |
Q: I run the same program on a 486 and on a Pentium, and it's slower on a Pentium!!
Lately, the FSF has split the GCC development into two branches: one is the regular GCC, while the other is called EGCS(Note: Pronounced like "eggs".), the Experimental GNU Compiler System. The latter is usually less stable than the GCC releases, but supports more advanced features, like the so-called Haifa scheduler, a new global subexpression elimination engine, and multi-language stuff. PGCC is a derivative of EGCS which supports additional optimizations specific to the x86 architecture; its optimizations for Pentium CPUs, and even for an i486, are better than those of GCC. So if you need to squeeze the last bits of performance from programs that target Pentium machines, use EGCS/PGCC to compile them. One drawback of EGCS/PGCC is that compilation is slower than with GCC and needs much more memory, sometimes an order of magnitude more, especially at higher optimization levels. PGCC was ported by Andrew Crabtree, and can be downloaded from the PCG site.
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 when GAS is built with the default DJGPP configuration, it treats 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 has 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 by EGCS/PGCC.
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.
webmaster donations bookstore | delorie software privacy |
Copyright ⌐ 1998 by Eli Zaretskii | Updated Sep 1998 |
You can help support this site by visiting the advertisers that sponsor it! (only once each, though)