Collapse
CollapsingX
  • - or -

Optimizing loop time


The first step to optimizing your project's processing time is to generate a trace file from the Matrox Profiler; the file includes statistics that will provide a very useful overview of the project's execution including, for example, the duration of individual steps. This might be the quickest way to cut out large chunks of unproductive processing time. For more information on generating a trace file, see the Profiling and troubleshooting logs section later in this chapter.

With this overview in mind, there are a number of optimizations you can still perform in your flowchart and operator view at design-time to reduce the amount of processing required when the project is deployed:

  • At design-time the project's execution time is determined by your host CPU, but the typical desktop computer is significantly faster than a supported Matrox smart camera's processor. Therefore, timing results at runtime are very different from the timing results at design-time, and it might be beneficial to adjust the Timeout of a particular step accordingly, using the information in the Matrox Profiler's generated trace file. The default Timeout for most steps is 2 sec.

  • Whenever possible, specify the number of occurrences you expect to find when using the PatternMatching step, the StringReader step, or the CodeReader step. The default settings will try to find all occurrences, even though you might only be interested in finding a specific few.

  • Whenever an Analysis and Processing step needs to work with an image, specifying a search region will force it to only work inside that region and ignore the rest of the image. This can eliminate unnecessary work, and minimize any unwanted noise that might affect the usefulness of the step's results. For more information, see the Search regions section in Chapter 2: Building a project.

  • If you are using an ImageProcessing step and the processing destination(s) will fill the entire output image, you do not need to initialize the destination buffer. Set the Image property to None and ClearImage to False to save the processing time required to perform a copy or clear.

When grabbing

There are certain optimizations you can do when grabbing images:

Analysis and Processing steps

There are several possible optimizations that can be done in the Analysis and Processing steps:

Operator view

There are some optimizations that can be done for the operator view:

Other

There are more general optimizations that can be done, outside the above steps:

  • The system automatically frees up memory and improves performance using a garbage collector, which periodically cleans up data objects that are no longer in use. The details of when the cleanup occurs can be set in the Performance tab of the Runtime properties dialog, accessible from the Project Runtime Properties menu item.

  • Unused data also need to be cleaned during the project's execution. You can manually decide when cleanup should occur:

    • At the end of each loop. Executes the cleanup each time it reaches the end of the selected loop. This option tends to give a more consistent loop time. Note that, even with this option selected, the system will perform the cleanup at any point should it become necessary.

    • Automatic. Allows the system decide when the cleanup will be made. This option tends to add a longer cleanup time during some iterations and no cleanup time during others.