Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

6 Compiling with optimization

GCC is an optimizing compiler. It provides a wide range of options which aim to increase the speed, or reduce the size, of the executable files it generates.

Optimization is a complex process. For each high-level command in the source code there are usually many possible combinations of machine instructions that can be used to achieve the appropriate final result. The compiler must consider these possibilities and choose among them.

In general, different code must be generated for different processors, as they use incompatible assembly and machine languages. Each type of processor also has its own characteristics--some CPUs provide a large number of registers for holding intermediate results of calculations, while others must store and fetch intermediate results from memory. Appropriate code must be generated in each case.

Furthermore, different amounts of time are needed for different instructions, depending on how they are ordered. GCC takes all these factors into account and tries to produce the fastest executable for a given system when compiling with optimization.


 
 
  Published under the terms of the GNU General Public License Design by Interspire