Improving the performance of the Fastpath execution mode
You improve the performance of the Fastpath execution mode by modifying the condition part of rules.
To improve the performance of the Fastpath execution algorithm, you can change the order of tests or conditions that are shared between several rules.
For more information, see Adjusting conditions.
- Ordering tests
- The order in which tests are carried out in rule conditions affects the performance of the pattern-matching process. To get the best performance for a specific condition, place the most discriminant tests at the start. This position accelerates the selection of objects in the discrimination tree for tests that involve constants. Also, when you place the most discriminant tests at the start, you know sooner when an object does not satisfy the tests between conditions in the joins.
- Ordering conditions in rules
- Place the most selective conditions, or groups of conditions, at the beginning of tests. In this way, the objects that prevent a rule from being run are removed sooner in the process. Tokens spend less time in the RetePlus network, joins require less memory, and fewer tests are necessary.
- Sharing conditions
- If the first N conditions of two rules are identical, these rules share the same portion of the network. As a consequence, searches for objects that satisfy these first N conditions are done only once for all the rules that share these conditions. It is therefore a good idea to modify the order of rule conditions so that they share the network as much as possible. Note that you cannot share conditions in the sequential execution mode.