Optimizing Page Recognition Performance

Detect Optimization Needs

To detect optimization needs in page declaration, you can use the recognition cost displayed in the page part of the Recognition tool window’ (see About the Recognition Mechanism).

For each page, the recognition cost expresses the number of components that must be tested in order to recognize the page. It is the sum of the number of components tested to recognize:

  • The page's root item

  • All of its MustExist items

  • All of its MustNotExist items

The recognition cost does not give a precise value of the time spent, but a high score (for example, more than 100) indicates pages that are good candidates for optimization.

Before recognizing a page, the UI Automation connector tries to recognize its preceding sibling pages. So, the actual recognition cost for a page is its own cost or the cost of its preceding sibling pages, whichever is greater (not the sum of both, thanks to cache management).

So, to optimize the recognition time of a specific page, you need to reduce the recognition cost of the page and of its preceding sibling pages.

Optimize Page Recognition

The first way to optimize page recognition consist in optimizing:

  • Recognition of its root item

  • Recognition of all of its MustExist items

  • Recognition of all its MustNotExist items

To do this, see Performance Optimization for Item Recognition.

Optimize Cache Management

Refreshing a page by means of polling can be time-consuming, because it requires the cache to be cleared and the searched subtree to be reloaded from the controlled application (see Performance Management).

To optimize cache management, it is possible to avoid refreshing subpages that are always present.

Example

You have to control an application with a main window (1) that permanently displays a TabControl with TabItems. You have to control two TabItems (2) and (3):

You declare the following pages:

  • pMainWindow to target the main window (required)

  • pTabItem1 and pTabItem2 as subpages of pMainWindow.

The pTabItem1 and pTabItem2 targets are not window components and must be detected by polling.

With this declaration, the whole application DOM tree is regularly reloaded. You can optimize performance by modifying your declaration as follows:

  • Declare a pTabControl page to target the TabControl component.

  • Since it is always present, you avoid refreshing the pTabControl page (see Page Parameters).

This way, only the TabControl DOM subtree is regularly reloaded.

In addition, as only one TabItem can be loaded at a time, you can set the pTabControl’s ‘Subpages type’ parameter to ‘Single’). This way, when one pTabItem SubPage is recognized, the software no longer tries to recognize other subpages of pTabControl.

Pages with a Single Subpage Instance

By default, a parent page that has multiple subpages tries to recognized all of its subpages.

When you declare a parent page to target a TabControl and subpages to target the TabItems, you know that only one subpage is present at one time.

You can then set the Subpages type parameter of the parent page to ‘Single’. This way, if one subpage is recognized, the parent page doesn’t try to recognize the others.

Pages with Multiple Instances

Most pages target only one screen. To optimize page recognition performance, the UI Automation connector only searches for a page's first target by default.

If you have to manage a page that has multiple targets, check its Multi-instance parameter.

For general information on declaring a page in Desktop Studio, see Declaring Pages.