Next: Notes on Formal Correctness
Up: Using the System
Previous: Debugging Support
Here we indicate some key features that can significantly
affect efficiency. Some of them are unsound in general, and hence
extreme care should be taken when using them.
Novice programmers may (and probably should) skip this section entirely.
- Indexing
CLP( ) employs first argument indexing for constructed functor
terms as well as real numbers. Using indexing can result in
significant speedups. - Tail recursion
Last call optimization is employed, and hence procedures that
are tail-recursive will not increase local stack usage. - Logical disjunction ``;/2'' and
if-then-else ``->/2''
These are implemented at the meta-level and hence are not
particularly efficient. - Dynamic code
Dynamic code is slower than static code and is also less
deterministic. Cuts can be used to make it more deterministic.
Also, since dynamic code is compiled, asserting large terms
may not be very fast. - Garbage collection
Not implemented as yet. - Implicit equalities
The solving of inequalities that imply some implicit equations can
be controlled using implicit/0, noimplicit/0,
partial_implicit/0 (see Section 5.1.7). - Asserting a rule
The predicate assert/1 involves incorporating the constraints
that relate the variables in that rule (see Section 3.4.2).
This is less efficient than if the constraints were not taken
into account. The fassert family of special
predicates (``fast assert'') performs assertion without
incorporating arithmetic constraints (see Section 5.1.7),
as in PROLOG.
Alan Borning
Fri Oct 8 12:51:18 PDT 1999