Prolog Language Performance Indexing


Example

All widely used Prolog interpreters use argument indexing to efficiently select suitable clauses.

Users can typically rely on at least first argument indexing, meaning that clauses can be efficiently told apart by the functor and arity of the outermost term of the first argument. In calls where that argument is sufficiently instantiated, matching clauses can essentially be selected in constant time via hashing on that argument.

More recently, JIT indexing has been implemented in more systems, enabling dynamic indexing on any argument that is sufficiently instantiated when the predicate is called.