<< Click to Display Table of Contents > 

Client Control Interface Manual > Optimization and Error Prevention > Optimize Performance

Optimize Performance
Previous pageReturn to chapter overviewNext page

The performance of SAMLight and thus your client control application can often be optimized by suppressing time consuming and unnecessary actions of the program. If a property of an entity (like the text or the size) has been changed by client control the entity will be regenerated and updated. Furthermore the View2D in SAMLight will be updated as well. Usually, these updates of the entity or the View2D are not necessary after every client control call. Here are some examples how the performance can be increased.

 

Only the top level entities:

If it is not necessary to execute a SAMLight Client Control command for all subentities of a top level entity, the iteration through all subentities can be globally suppressed and the SAMLight Client Control command is executed for the top level entity only. Use the FlagToplevelOnly flag:

Only top level entities
 

//Get the current mode

int current_mode = 0;

cci.ScGetMode(ref current_mode);

//update the current mode by adding an additional TopLevelEntity Flag

current_mode |= (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlDoubleDataIdFlagToplevelOnly;

//Set the new mode value

cci.ScSetMode(current_mode);

Table 449: Only top level entities

Disable automatic View2D update of SAMLight:

If you are not using the View2D of SAMLight because you launch SAMLight in hidden mode or your application is automatized without needing a visual view, you can disable the View2D completely. Use the FlagDontUpdateView flag:

Disable the View2D update
 

//Get the current mode

int current_mode = 0;

cci.ScGetMode(ref current_mode);

//update the current mode by adding an additional DontUpdateView Flag

current_mode |= (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlDoubleDataIdFlagDontUpdateView;

//Set the new mode value

cci.ScSetMode(current_mode);

Table 450: Disable the View2D update
 

If there's a need to update the view, you can do it by executiong the UpdateViewNow command:

Manual view update
 

cci.ScExecCommand((int)ScComSAMLightClientCtrlExecCommandConstants.scComSAMLightClientCtrlExecCommandUpdateViewNow);

Table 451: Manual view update

Execute SAMLight Client Control command for several entities:

The time consuming part of a client control application can be the COM call itself. The processing time for the client interface application can be reduced if you want to use the same CI call for several entities. An example is changing the text of several entities with just one COM call. This can be done by using semicolon separated entity names which has to be activated by: ScSetMode() with the flag NamesSeparatedBySemicolon:

Disable the View2D update
 

//Get the current mode

int current_mode = 0;

cci.ScGetMode(ref current_mode);

//update the current mode by adding an additional DontUpdateView Flag

current_mode |= (int)ScComSAMLightClientCtrlFlags.scComSAMLightClientCtrlDoubleDataIdFlagDontUpdateView;

//Set the new mode value

cci.ScSetMode(current_mode);

Table 452: Disable the View2D update

Suppress View2D update if you change more than one property of the same entity at once:

Like mentioned above every entity change will be shown in View2D after any change of its properties. If you want to change more than one property of the same entity, you can suppress View2D update of the entity. Then the change of the entity will not be shown after after every call. To do so use:

ScSetEntityLongData() with flag FlagDontUpdateView

ScSetEntityDoubleData() with flag FlagDontUpdateView

ScSetEntityStringData() with flag FlagDontUpdateView

You will find a detailed example in the chapter Optimize performance: Example 1.

 

Suppress entity update if you change more than one property of the same entity at once:

Like mentioned above every entity will be regenerated and updated after any change of its properties. If you want to change more than one property of the same entity you can suppress this behavior so that the entity will not be regenerated and updated after after every call.

ScSetEntityLongData() with flag FlagDontUpdateEntity

ScSetEntityDoubleData() with flag FlagDontUpdateEntity

ScSetEntityStringData() with flag FlagDontUpdateEntity

 

note

Please make sure that you are not using this flag at the last change of an entity. Otherwise this entity will not be regenerated and updated at all.

 

You will find a detailed example in the chapter Programming Examples:

 

Address top level entities only:

For many CI calls you address an entity by its name or ID to set or get its parameters. To find this entity SAMLight is looking for the name or ID in every group or subgroup of the entire entity hierarchy. To decrease the time which is necessary to find the corresponding entity you want to address the search can be limited to top level entities:

ScSetEntityLongData() with flag FlagToplevelOnly

ScSetEntityDoubleData() with flag FlagToplevelOnly

ScSetEntityStringData() with flag FlagToplevelOnly

 

Use trigger mode:

In this mode the next job to be marked is prepared and sent to the controller card before the mark call has been sent. As soon as the external trigger is recognized by the controller card the marking process will start. If this mode is not enabled the job will be prepared and sent to the controller card after the external trigger was recognized.

ScSetMarkFlags() with flag MarkFlagWaitForTrigger

note

Please note that the logging of CCI commands also is time consuming. Thus, we would recommend to only activate the sc_cci_debug.txt when doing some debugging and not during the normal operation.