[comp.lang.prolog] Comparing Prolog with other languages

vanroy@bellatrix.uucp (02/20/89)

Does anyone know of any comparisons of algorithms implemented in Prolog
versus in another (possibly procedural) language?  This involves writing the
algorithm in a natural style in Prolog and in the other language, and using 
production compilers to compare the execution speeds.  The results depend
on several factors: (1) the choice of algorithm, (2) the quality of the Prolog
implementation, (3) the quality of the implementation of the other language,
and (4) the suitability of the architecture for Prolog.
  Since traditional "general-purpose" architectures are really not suited
very well for symbolic languages, this comparison will be biased towards
the other language.
  I know of one such comparison done at Argonne in which a theorem prover
was written in Prolog and in C.  The C version consistently outperformed
the Prolog version by an order of magnitude.  Has anyone done any other
comparisons of this sort?
  Thanks for any pointers,

	Peter Van Roy
	vanroy@bellatrix.berkeley.edu

bts@evergreen.cs.unc.edu (Bruce Smith) (02/25/89)

In <28091@ucbvax.BERKELEY.EDU> Peter Van Roy (vanroy@bellatrix.berkeley.edu)
raises a good question about Prolog performance.  I have tried-- as I suspect
many have-- comparisions of Quintus (or any other favorite) Prolog vs. C, but
the programs are either trivial or I do not have the patience to write both.
(Quintus was almost always within an order of magnitude, but always slower.)

Peter Reintjes (usually pbr@mcnc, but temporarily off the net) wrote VLSI CAD
tools in Prolog-- based in part on earlier tools written in C-- but he mainly
emphasized software engineering aspects, not performance. (See, for instance,
"A VLSI Design Environment in Prolog", in LP'88.)

I'd like to hear from anyone who's done more comprehensive comparisions.  And,
does anyone have a strong intuition on when the Prolog programs will run near
the C programs in speed?  It's tempting to say on "symbolic" problems, but is
a theorem prover (even a propositional one) not symbolic?

	Bruce T. Smith

carl@hemlock.aero.org (Carl Kesselman) (02/25/89)

Mats Carlsson and I have spent a bit of time studying a propositional 
therom prover written by Ross Overbeek.  Ross origionally wrote identical
versions in C and Prolog with the C version being much faster.  However,
after studying the program using the Gauge performance analysis system,
we were able to get the prolog performance within 25% of the C version.
Both Gauge and the theorm prover were run under Sicstus prolog.  The
execution time for the prover was obtained using a preliminary version 
of a native code compiler.

Carl