IBM Support

Optimizing IBM Rational Rhapsody in C generated applications

Technote (FAQ)


Question

How can I optimize my IBM Rational Rhapsody in C generated applications?

Answer

There are two ways to optimize your generated applications in Rhapsody in C. Sometimes these are opposing concerns.

For instance, faster performance may cause an increase in application size, while decreasing application size may cause performance degradation. In general, you can achieve a performance and size improvement from the following:

  • Set Instrumentation in the "Configurations::Settings" dialog to "None". This will strip the code of all design level debug statements, and the code will be smaller and run faster.
  • Set Statechart Implementation in the "Configurations::Settings" dialog to "Flat", which will result in faster code.
  • Set the Build Set in the "Configurations::Settings" dialog to "Release". This will force your environment to construct the application without source level debug information.
  • Check your specific environment documentation for other possible effects.

How can I optimize my Rhapsody in C applications for performance?

Set the
CG::Class::"ComplexityForInlining"
property to its maximum of 5. This property allows you to specify that Rhapsody in-line operations contain 5 or less (when set to 5) lines of code. Although this increases the overall size of the generated application, you are able to obtain up to a 10% increase in performance over the default setting for the property of 3.

Implement relations as real arrays by setting the "Implementation" property to "StaticArray" or "Scalar" instead of using the default implementation. Although less flexible, the array implementation is simpler and faster. Use a custom implementation of the relation. To do this, create an optimized implementation and make Rhapsody use it by first adding the interface to the "User" metaclass (under the subject "RiCContainers"), and then setting the "Implementation" property for the relation to "User".

How can I optimize my Rhapsody in C applications for size?

Remove unnecessary accessors, mutators, and link methods by setting the properties "AccessorGenerate" and "MutatorGenerate" (SetGenerate and GetGenerate in &.5.3) for attributes and relations to "False". This will prevent Rhapsody from generating the operations, but will require the developer to do this explicitly.

Implement relations as real arrays by setting the "Implementation" property to "StaticArray" or "Scalar" instead of using the default implementation. Although less flexible, the array implementation consumes less space. Do not implement links to global or singleton objects by setting the "Generate" property for the relation to "False". In environments that support it, strip the executable by adding the necessary switch to the Link Switches setting for the configuration (for example: -s in VxWorks).

Using A Post Processor

Starting in Rhapsody 4.2 it is possible to perform post processing of generated code with Rhapsody. This is done through the "
CG::File::InvokePostProcessor
" property. If you want to run a "Beautify" utility, or other such post processing tool, it can now be done on a file by file basis automatically from Rhapsody.

Historical Number

10314

Document information

More support for: Rational Rhapsody
General Information

Software version: 7.5.1, 7.5.1.1, 7.5.2, 7.5.2.1, 7.5.3, 7.5.3.1, 7.5.3.2, 7.6

Operating system(s): Linux, Windows

Reference #: 1323628

Modified date: 25 June 2007