Node:How fast, Next:, Previous:Performance, Up:Performance

14.1 How efficient is DJGPP-generated code?

Q: How does DJGPP compare with other DOS-based C compilers in terms of efficiency of generated code?

Q: Won't my program run much slower when compiled by DJGPP, due to all those CPU cycles wasted in switches between protected and real mode?

A: The quality of code generated by GCC with optimization turned on (-O2 switch to the compiler) is generally at least as good as what you will get from top commercial products, like Borland, Microsoft and Watcom. Mode switches indeed impose a certain performance hit, but in most programs it is negligibly small, because only DOS and BIOS services require such a switch, and the majority of programs spend most of their time doing other things.

Up until version 2.95, MSVC was the only one of the commercial compilers that used to produce code which was better than what GCC generated (by about 25% on the average), when run on a Pentium. However, with the much-improved optimization technology that is now part of GCC 2.95 and later, this gap is all but closed. More details about this are available on the compiler comparison page, maintained by Salvador Eduardo Tropea.