NOTE: To use the advanced features of this site you need javascript turned on.

Home Knowledge Base Software Migrators Optimizations In The Migration Process

Optimizations In The Migration Process

Usually, there are multiple alternatives to perform a certain operation in a certain programming language. The selected alternative should be the one that offers the best balance between efficiency and maintenance, depending on the context.

Optimizations target different areas and differ in generality, as illustrated below:



Algorithm optimizations are the most generic. They operate with high-level concepts and are not dependent on the programming language. As a consequence, algorithm optimizations are automatically propagated in the translation process. For example, using the quick-sort algorithm to sort vector elements instead of the bubble-sort algorithm is an optimization in any programming language, due to its higher efficiency.

Structural optimizations refer to the logical structure of the source code. They can be either semi-automated (refactoring) or automated.

Semi-automated optimizations require user intervention to trigger the process and set the parameters for a certain optimization category. Some examples are:

  • identifier renaming,

  • source code relocation,

  • subprogram extraction,

  • local variable and constant extraction,

  • increasing variable visibility.

For an extensive list and additional details, consult Martin Fowler's Refactoring site.

Automated optimizations can be directly applied by the optimization module of the language translator (compiler, migrator etc.). Some basic examples are:

  • loop optimizations: fission, fusion, invariant code extraction;

  • data-flow optimizations: common subexpression elimination, constant folding and propagation;

  • dead code elimination.

A good start for obtaining further information is the Wikipedia Compiler Optimization page.

Halstead metrics can be used to measure the effect of structural optimizations on the source code complexity.

Language-specific optimizations refer to maximizing the efficiency of the source code by fully using the features of a programming language. Using pointer arithmetics in C is an example of such optimization.

Architectural optimizations refer to the manner in which a certain feature or service is implemented. One example is switching from a file-based persistence layer to a better performing database layer.

Algorithm, structural and architectural optimizations that are already applied to the original application are translated as such by a software migrator. Language-specific optimizations however may be lost if they do not have a correspondent in the target language. For example, using pointer arithmetics in C to increase performance is an optimization that would be lost when translating into Java™, because Java™ does not have pointers.

The migration process also provides the opportunity of applying additional optimizations along with the translation itself. This however increases the complexity of the migration process and decreases traceability (one-to-one correspondence between original constructions and their translated counterparts). Therefore, only those optimizations that are not easily performed at a later stage, using the tools of the target language, should be made during migration.