PEREIRA@SRI-AI.ARPA (04/22/83)
I'm re-sending this article via a new route, to test it. Could you please tell me when it arrives? I've sent it also via UDEL -- Fernando --------------- Date: Thu 21 Apr 83 09:21:41-PST From: PEREIRA@SRI-AI Subject: more "Prolog compared with Lisp" To: bts.unc@UDEL-RELAY Richard O'Keefe from Edinburgh mentioned the lamentable Gutierrez article and his reply on SigPlan, of which I have only seen an early version. For the benefit of those on this newsgroup that have seen neither article, and that may be inclined to infer from the exchanges that this is yet another "holy war", I will give my own view of the debate to the best of my recollection. Needless to say, I agree with Richard! But first of all a bit of history. In the mid-seventies, when David Warren designed the first version of the Edinburgh compiler, nobody would believe that Prolog (after all just a "dumb theorem prover") could be used efficiently for practical programming tasks. We then ran some simple benchmarks between simple (almost) pure Lisp and pure Prolog (ie. no assert & friends), for some simple tasks such as list concatenation, sorting and ranking and differentiation. We reported the results of these experiments in "Prolog - the language and its implementation compared with Lisp" which appeared in SigPlan of Aug. 77. In the area of performance comparison, that paper concluded the speed of pure Prolog programs compiled with that version of David's compiler was with a factor of two of that of analogous as pure as possible Lisp programs compiled with the Lisp 1.6 compiler. Since then, there has been a new improved Prolog compiler that makes the same sort of programs comparable with their counterparts compiled with the MacLisp compiler. Gutierrez's task was some sort of theorem prover. It was implemented in Lisp using a rather low level style (ie. SETQ, RPLAC? and loops instead of recursion and consing). His Prolog version is possibly the worst written Prolog program I have ever seen. The whole operation of the program is made of 'assert' and 'retract' and other evaluable predicates, with hardly any declarative content. That is the program is a benchmark of the Prolog database operations, not of Prolog. In fact, I was surprised that such a program was only twice as slow as its Lisp counterpart! One writes nondeclarative Prolog programs for various reasons: (1) poor understanding of logic programming (2) not knowing how to formulate the whole task in pure Prolog (3) circumventing limitations of the Prolog system or machine (4) expressive limitations of definite clauses Gutierrez's program seems to be the result of (1) and (2). I have variously suffered from the four complaints. As with any other language, it takes a long time for anyone to develop a style that fits the "expressive profile" of the language, and clearly Gutierrez hadn't been through that. --- And now a message from our sponsor ---- Let me use this article to push one of my pet concerns: before you use those 'assert's, or even cut, think, THINK VERY HARD. You may well be rewarded with a much cleaner and enlightening description of the task. --- end of message --- The original comparison paper was necessary because few people accepted that Prolog was a useful and efficient language. Today, such comparisons are no longer needed: witness the number of people putting up with rather slow interpreters, people who use Prolog primarily for its expressive power, not for speed. For the future, the important benchmarks and studies of efficiency are those between different implementation techniques for Prolog and logic programming in general, and those related to new computer architectures for logic programming. Fernando Pereira ------- -------