Abstract
As logic programming applications grow in size, Prolog systems need to efficiently access larger and larger data sets and the need for any- and multi-argument indexing becomes more and more profound. Static generation of multi-argument indexing is one alternative, but applications often rely on features that are inherently dynamic which makes static techniques inapplicable or inaccurate. Another alternative is to employ dynamic schemes for flexible demand-driven indexing of Prolog clauses. We propose such schemes and discuss issues that need to be addressed for their efficient implementation in the context of WAM-based Prolog systems. We have implemented demand-driven indexing in two different Prolog systems and have been able to obtain non-negligible performance speedups: from a few percent up to orders of magnitude. Given these results, we see very little reason for Prolog systems not to incorporate some form of dynamic indexing based on actual demand. In fact, we see demand-driven indexing as only the first step towards effective runtime optimization of Prolog programs.
Dedicated to the memory of our friend, colleague and co-author Ricardo Lopes. We miss you!
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Warren, D.H.D.: An abstract Prolog instruction set. Tech. Note 309, SRI International (1983)
Santos Costa, V., Damas, L., Reis, R., Azevedo, R.: YAP User’s Manual (2002)
Carlsson, M.: On the efficiency of optimising shallow backtracking in compiled Prolog. In: Levi, G., Martelli, M. (eds.) Proceedings of the Sixth ICLP, pp. 3–15. MIT Press, Cambridge (1989)
Demoen, B., Mariën, A., Callebaut, A.: Indexing in Prolog. In: Lusk, E.L., Overbeek, R.A. (eds.) Proceedings of NACLP, pp. 1001–1012. MIT Press, Cambridge (1989)
Wielemaker, J.: SWI-Prolog 5.1: Reference Manual. SWI, University of Amsterdam, Roetersstraat 15, 1018 WB Amsterdam, The Netherlands (1997-2003)
Sagonas, K.F., Swift, T., Warren, D.S., Freire, J., Rao, P.: The XSB Programmer’s Manual. State University of New York at Stony Brook (1997)
Troncon, R., Janssens, G., Demoen, B., Vandecasteele, H.: Fast frequent quering with lazy control flow compilation. Theory and Practice of Logic Programming (2007) (to appear)
Hickey, T., Mudambi, S.: Global compilation of Prolog. JLP 7(3), 193–230 (1989)
Van Roy, P., Demoen, B., Willems, Y.D.: Improving the execution speed of compiled Prolog with modes, clause selection and determinism. In: Ehrig, H., Levi, G., Montanari, U. (eds.) CAAP 1987 and TAPSOFT 1987. LNCS, vol. 249, pp. 111–125. Springer, Heidelberg (1987)
Zhou, N.F., Takagi, T., Kazuo, U.: A matching tree oriented abstract machine for Prolog. In: Warren, D.H.D., Szeredi, P. (eds.) ICLP 1990, pp. 158–173. MIT Press, Cambridge (1990)
Dawson, S., Ramakrishnan, C.R., Ramakrishnan, I.V., Sagonas, K., Skiena, S., Swift, T., Warren, D.S.: Unification factoring for the efficient execution of logic programs. In: Conference Record of POPL 1995, pp. 247–258. ACM Press, New York (1995)
Ramakrishnan, I.V., Rao, P., Sagonas, K., Swift, T., Warren, D.S.: Efficient access mechanisms for tabled logic programs. Journal of Logic Programming 38(1), 31–54 (1999)
Kliger, S., Shapiro, E.: A decision tree compilation algorithm for FCP(|,:?). In: Proceedings of the Fifth ICSLP, pp. 1315–1336. MIT Press, Cambridge (1988)
Somogyi, Z., Henderson, F., Conway, T.: The execution algorithm of Mercury, an efficient purely declarative logic programming language. JLP 26(1-3), 17–64 (1996)
Hermenegildo, M.V., Puebla, G., Bueno, F., LĂ³pez-GarcĂa, P.: Integrated program debugging, verification, and optimization using abstract interpretation (and the Ciao system preprocessor). Science of Computer Programming 58(1–2), 115–140 (2005)
Carlsson, M.: Freeze, indexing, and other implementation issues in the WAM. In: Lassez, J.L. (ed.) Proceedings of the Fourth ICLP, pp. 40–58. MIT Press, Cambridge (1987)
Srinivasan, A.: The Aleph Manual (2001)
Author information
Authors and Affiliations
Editor information
Rights and permissions
Copyright information
© 2007 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Santos Costa, V., Sagonas, K., Lopes, R. (2007). Demand-Driven Indexing of Prolog Clauses. In: Dahl, V., Niemelä, I. (eds) Logic Programming. ICLP 2007. Lecture Notes in Computer Science, vol 4670. Springer, Berlin, Heidelberg. https://doi.org/10.1007/978-3-540-74610-2_27
Download citation
DOI: https://doi.org/10.1007/978-3-540-74610-2_27
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-74608-9
Online ISBN: 978-3-540-74610-2
eBook Packages: Computer ScienceComputer Science (R0)