(only tested in CoSy-fSDL-mode)
If an XGRS has order 2, and uses attribute equality tests on its rule test root nodes, it can be speed up by the use of index structures.
If an index is specified on a variable, the code generation changes as follows. First the order loop node domain of the specified variable is traversed to collect all objects into the index structure. Then the index is used as virtual edge between the two root nodes of the rule. This virtual edge is traversed during rule test. The rule (and may be the rule group) gets order 1 and will be generated with other rules that have the same (single) range.
Currently there are hash tables (multi-valued index) and plain pointer tables (one-valued).4.1 emits calls to C modules which both can be found in the sol-library.
transforms logically into
The index function may be accompanied with the following functions in order:
int hash value. C
signature:
strcmp: give back 0 if object 1 is equal to
object 2, -1 if smaller, 1 if
greater. Example:
If one of them is left out, chooses a standard function (probably behaving inefficient). Choosing appropriate hash functions is quite important. Also note that the hash function has to be specified anyway: if it is left out, a dummy void function has to be specified instead.