The process of improving SourceCode and/or its resulting MachineCode with regard to a certain aspect. Such aspects include:
- Does what it says: the program runs faster.
This is the aspect commonly referred to when the term Optimisation is used.
- Object code size:
- Reduces the size of large applications (such as browsers, office suites, and the like) or frequently downloaded code (such as scripts and applets on WebSites).
As a side effect, Cache locality of the code improves, so performance will often benefit as well.
This is the second most commonly referred to aspect of Optimisation.
- Compilation time:
- Improves the perceived responsiveness of code compiled dynamically in reaction to user requests.
- Leverages the resources of SMP systems better, because MultiThreaded tasks can take advantage of multiple CPUs at once.
In practice, you always need a balance among these.
There are other aspects which relate to the development-time rather than the run-time which can also be thought of as optimisations:
- Reduces the effort and thus cost of designing and implementing new features. See also Refactoring.
- Allows deploying the SourceCode on more than one platforms.
This often requires avoiding other, platform-specific Optimisation techniques.
Again, balance is necessary.