Discussion Body Variable Elimination

In this section we will provide a critical discussion of the impact of the body variable elimina-tion optimization. The average speed up factor is around 83.9%. The worst slow-down factor is around 103.5% for the test program crypt. The result is closely followed by the test program perfect. The best speed up factor is around 69.3% for the test program deriv. The result is closely followed by the test program calc.

Picture 5: Body Variable Elimination Impact

The body variable elimination optimization introduces a new instruction. The new instruction that is added to the intermediate form is “dispose_bind”. This instruction has only an optimizing effect for deterministic predicates. In case of non-deterministic predicates the instructions are invoked over and over again without any further effect. As consequence body variable elimination largely causes only overhead for non-deterministic predicates which can be seen in the lesser improvement for this group of test programs.

When a clause variable is part of a clause structure which is matched with a non-ground argument it might get referenced and thus cannot be disposed. Since we do not do display shrinking, this also prevents reclamation of displays. The last argument of the predicate concatenate/3 in the test program nrev is for example is structure resulting in this sense. We guess that these structures resulting arguments cause a considerable overhead which is seen in the timing diagram. It even affects non-deterministic test programs such as crypt when they make use of deterministic predicates with structure resulting arguments.

On the other hand the body variable elimination will see to it that non-structure resulting arguments are quickly released. Especially intermediate results that are atomic are detected by the body variable elimination. This means that for example intermediate number results from evaluations are quickly made available to the garbage collection of the Java memory management. Last but not least the destruction structure input arguments will need some place holders. These place holders will also be reclaimed as soon as the destructed components are passed to further predicates and the place holders are not anymore needed.

Kommentare