Member attributes: Optimization

Before Embedded Wizard version 9.0 this attribute was used to control the optimization level when generating code for a particular profile member.

Syntax

None

Low

Medium

High

Discussion

The value of the attribute Optimization has affected the code generation. Depending on the value of this attribute, the Code Generator performed different code simplification and elimination steps. Following levels were available:

Level

Description

None

No optimization is performed.

Low

Performs rudimentary optimization steps. All non-overridden methods are invoked directly, without an indirection through a virtual method table (VMT). Wherever possible properties are accessed without the invocation of their onget or onset methods.

Medium

Like the level Low. Additionally the layout of Chora objects is optimized in order to reduce the RAM usage. The exact behavior of this optimization level depends on the particular Code Generator. Usually the order of the object’s members is modified in order to arrange small 8/16 bit variables together.

High

Like the level Medium. Additionally all unused (unreferenced) project members are excluded from the code generation (eliminated). This optimization level results in the smallest and fastest GUI applications. You can override the automatic elimination of a member by setting its Generator attribute to the value true.

Modify the attribute

With the version 9.0 the attribute Optimization has been declared as deprecated. Accordingly, this attribute is not listed anymore in the Inspector window when you have selected a profile member. From now, the code generation is always performed with the maximum possible optimization level High. You can't modify this attribute.

TIP

If you have needed to change the attribute Optimization to the value other than High in order to suppress the automatic elimination of unused project members, you can achieve similar effect by setting the attribute Generator of the affected member to the value true.

If you implement a native code section which refers a local variable or local array ensure that the name of the affected variable or array is correctly introduced in the native statement. Without this, the local variable or array may be eliminated during code generation.