The University of Arizona
banner image

  Profiling Prolog Programs

Saumya Debray
Department of Computer Science
The University of Arizona
Tucson, AZ 85721, U.S.A.
 

Abstract
Profilers play an important role in the development of efficient programs. Profiling techniques developed for traditional languages are inadequate for logic programming languages, for a number of reasons: first, the flow of control in logic programming languages, involving backtracking and failure, is significantly more complex than in traditional languages; second, the time taken by a unification operation, the principal primitive operation of such languages, cannot be predicted statically because it depends on the size of the input; and finally, programs may change at runtime because clauses may be added or deleted using primitives like assert and retract. In this paper we describe a simple profiler for Prolog. The ideas outlined here may either be used to implement a simple interactive profiler, or be integrated into Prolog compilers.